Multiple columns after WHERE statement that uses LIKE SQLITE

64 Views Asked by At

i am tying to do a query like this

select * from tablename where column1 or column2 or column3 like '%input%';

but it only seems to do the query to the last column.

How can i query so it looks for that input in all three columns and outputs me with whatever matches from any of those columns.

1

There are 1 best solutions below

0
Gordon Linoff On BEST ANSWER

You need to repeat the condition:

where column1 like '%input%' or
      column2 like '%input%' or
      column3 like '%input%'

or connects boolean expressions in SQL. It does not connect operands, such as the string comparison for like.