cancel
Showing results for 
Search instead for 
Did you mean: 

Clean way to do conditional statement in SQL?

ekallivrousis
New Contributor III

I was wondering what the best way to do conditional update in q? I know i can do the below but wondering if theres a shorter/cleaner way.

 

 

 

t:flip `a`b!(1 2;01b)
update c:{$[x;`true;`false]} each b from t

 

 

 

1 ACCEPTED SOLUTION

vkennedy
New Contributor II
New Contributor II

update c:?[b;`true;`false] from t

View solution in original post

3 REPLIES 3

vkennedy
New Contributor II
New Contributor II

update c:?[b;`true;`false] from t

exactly what i was looking for! thank you

soheir
New Contributor II
New Contributor II

Hi @ekallivrousis, try using a vector conditional - https://code.kx.com/q/ref/vector-conditional/

update c:?[b;`true;`false] from t

b = vector of booleans being passed in