canadian_angel Posted July 21, 2010 Share Posted July 21, 2010 I need to expand on the first query by counting the number of flights from the citys in my airline database and so far have come up with the second query; The tables in the database are flight, and city. flight columns:number, origincityid,destinationcityid,departure,duration and stops city columns:id and name SELECT city.name, flight.origincityid FROM city LEFT JOIN flight ON city.id=origincityid SELECT city.name, COUNT(origincityid.id) AS numflight ->FROM city LEFT JOIN flight ON origincityid=origincityid.id ->city.name; Link to comment https://forums.phpfreaks.com/topic/208368-mysql-help-left-join/ Share on other sites More sharing options...
fenway Posted July 23, 2010 Share Posted July 23, 2010 You need a group by Link to comment https://forums.phpfreaks.com/topic/208368-mysql-help-left-join/#findComment-1090342 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.