View Full Version : SQL query JOIN and LIKE clause

01-28-2007, 04:21 PM

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)

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

What error are you getting?

01-28-2007, 09: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.

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