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; Quote 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 Quote Link to comment https://forums.phpfreaks.com/topic/208368-mysql-help-left-join/#findComment-1090342 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.