Welcome Guest, Not a member yet? Register   Sign In
help with a mysql sql statement
#4

[eluser]darkhouse[/eluser]
Ok, how about this:

SELECT l.*, ci.*
FROM ad_listing l
JOIN ad_listing_categories ca ON l.AdID = ca.AdID --do you even need this?
LEFT JOIN ad_listing_cities ci ON l.AdID = ci.AdID
WHERE l.active = 1 AND (ci.CityID = 192 OR l.CityID = 192)

You don't need to group by CityID because there's only 1, so that's why you'll only get 1 result.


Messages In This Thread
help with a mysql sql statement - by El Forum - 06-09-2009, 05:34 PM
help with a mysql sql statement - by El Forum - 06-09-2009, 10:16 PM
help with a mysql sql statement - by El Forum - 06-10-2009, 12:55 AM
help with a mysql sql statement - by El Forum - 06-10-2009, 01:00 AM
help with a mysql sql statement - by El Forum - 06-10-2009, 01:06 AM
help with a mysql sql statement - by El Forum - 06-10-2009, 01:12 AM
help with a mysql sql statement - by El Forum - 06-10-2009, 01:35 AM
help with a mysql sql statement - by El Forum - 06-10-2009, 06:35 AM
help with a mysql sql statement - by El Forum - 06-10-2009, 09:24 AM
help with a mysql sql statement - by El Forum - 06-10-2009, 09:31 AM



Theme © iAndrew 2016 - Forum software by © MyBB