LIKE operator

A

Anonymous

Guest
Is it possible to specify more than one column for search using the LIKE operator?

This is what I have been trying:

Code:
SELECT * FROM some_table WHERE year = '1' AND 
column1 LIKE "%some name%" OR column2  LIKE "%some name%" 
ORDER BY column1 ASC

When I run this query i get all results irrespective of the "year" in my where clause. Seems like the query is not considering the year

Any help is appreciated
 
I wonder if mysql is using it as 'year=1 and column1=something' OR 'column2=something' try changing the order - where column1 or column2 AND year - might be different then?

Andrew
 
Back
Top