How to use In clause with big list of commas separated values #112
ivishalgandhi
started this conversation in
General
Replies: 3 comments 1 reply
-
As far as I know, $ export USERS="'u1','u2','u3'"
$ echo 'SELECT * FROM STDIN WHERE user in ($USERS);' | envsubst
SELECT * FROM STDIN WHERE user in ('u1','u2','u3'); |
Beta Was this translation helpful? Give feedback.
0 replies
-
And yet another command I didn't know :-)-O Even through the answer lies on the quotes and I would think that csvq "select * from users where user_name in $USER_NAME" should work. |
Beta Was this translation helpful? Give feedback.
1 reply
-
You can use the execute command to execute a string as a query. $ csvq "EXECUTE 'SELECT * FROM users WHERE user_name IN (%s)' USING @%USER_NAME"
|
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
how to use env variable/variable with big list of comma sep values
e.g.
shell : export USER_NAME= "'u1','u2 2','u3'"
csvq 'select * from users where user_name in $USER_NAME'
Beta Was this translation helpful? Give feedback.
All reactions