sql - how do i filter a column with multiple values -


how filter column col1 multiple values

select * table col1=2 , col1=4 ,  userid='740b9738-63d2-67ff-ba21-801b65dd0ae1'  

i tired

select * table col1=2 or col1=4 ,  userid='740b9738-63d2-67ff-ba21-801b65dd0ae1' 

the result of both queries incorrect

the first 1 gives 0 results second 1 gives 3 results

the correct 2 results

the sql run against sqlite db.

and evaluated before or, query equivalent to:

select *  table  col1=2 or (col1=4 ,  userid='740b9738-63d2-67ff-ba21-801b65dd0ae1') 

you need explicitly group conditions when mixing and , or:

select *  table  (col1=2 or col1=4) ,  userid='740b9738-63d2-67ff-ba21-801b65dd0ae1' 

Comments

Popular posts from this blog

hibernate - How to load global settings frequently used in application in Java -

python 3.x - Mapping specific letters onto a list of words -

objective c - Ownership modifiers with manual reference counting -