mysql joining empty rows?
i have this query
SELECT cities.city, city_date.date_avail
FROM cities, city_date
WHERE city_date.city_id = cities.id;
but i would like the q开发者_运维百科uery to return all the cities from cities even if they dont have a city_date associated with it?
see OUTER JOINS ;) (RIGHT / LEFT / FULL)
SELECT cities.city, city_date.date_avail
FROM cities
LEFT OUTER JOIN city_date ON city_date.city_id = cities.id;
精彩评论