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

apache - Remove .php and add trailing slash in url using htaccess not loading css -

javascript - jQuery show full size image on click -