Answer the question
In order to leave comments, you need to log in
How to do multi-column search in SQL?
There is a field (input type="search" name="search"). I have a table with five columns.
How to find an entry, for example, in the second column and in the third?
Tried like this:
Select * from `table` where `colum3` & `column2` Like '%$search%'
Select * from `table` where `colum3` AND `column2` Like '%$search%'
Answer the question
In order to leave comments, you need to log in
Got it right:
Select * from `table` where `colum3` Like '%$search%' OR `column2` Like '%$search%'
select * from table where column2 = $search
union
select * from table where column3 = $search
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question