...

View Full Version : SQL query JOIN and LIKE clause



alex57
01-28-2007, 03:21 PM
Hello,

I need to run a query which uses a like query like the one below, no problem:


SELECT * FROM footballers WHERE sname LIKE '%$criteria%'

however, if I want to join two tables and still use the LIKE clause how would the syntax look??

My guess below was incorrect. any help would be appreciated. thank you


WHERE sname LIKE '%$criteria%' AND (footballers.footballerID = PremTeams.footballerID)

Fumigator
01-28-2007, 08:44 PM
That syntax works fine for me...

What error are you getting?

guelphdad
01-28-2007, 08:45 PM
show us your entire query instead of some of it. for instance if you parsed the second bit above to the first bit you would get an error because you dont have the first table named.

alex57
01-29-2007, 12:47 PM
O got it working now thanks, stupid error, it was a typo. thanks anyway



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum