I'm trying to get values that equal both b.business_id = 22 and l.zip = 91326. The easiest thing for me to try was select l.*,b.name from buslocations AS l left join business as b where b.business_id = '22' and l.zip = '91326'
but apparently there is something wrong with that. Any assistance with the correct syntax for two defined values would be appreciated.
views:
23answers:
2
+2
A:
you need to match the tables by some key or value using ON such as:
select l.*,b.name from buslocations AS l left join business as b ON l.x=b.Y WHERE b.business_id = '22' and l.zip = '91326'
dusoft
2009-08-31 07:45:58
eek, I must be tired. Thanks.
ivannovak
2009-08-31 07:47:59
...and dusoft wins the race. : )
Aaron F.
2009-08-31 07:48:02
+1
A:
Your join query needs to specify on which columns you're joining the two tables.
Aaron F.
2009-08-31 07:47:32