You cannot make a conditional join the way you want, but instead you can:
SELECT PLD.FROM, PLD.UNTIL, IF(PLD.isAvailable, 'Yes', 'No') AS isAvailable, PL.*
FROM (
SELECT plid
, MIN(available_date) AS `FROM`
, MAX(available_date) AS `UNTIL`
, DATEDIFF('2012-04-01', '2012-04-10') = COUNT(*) - 1 AS `isAvailable`
FROM parking_lot_dates
WHERE available_date BETWEEN '2012-04-01' AND '2012-04-10'
GROUP BY plid
) AS PLD LEFT JOIN parking_lots AS PL ON (
PLD.isAvailable AND PL.plid = PLD.plid
)
WHERE NOT (PLD.isAvailable AND PL.plid IS NULL)
A subquery performs a grouping operation on a table parking_lot_dates, and we make an outer join between this and the table parking_lotsto have records, even if the join condition is not satisfied. More on SQL joins .
WHERE INNER JOIN, , parking_lots, ; , .