Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

SELECT Clause WHERE variable not in value list

Former Member
0 Likes
17,336

Hello Masters,

I've got a question: In SQL language we can do a query like:


 SELECT my_variables FROM my_table WHERE my_variable NOT IN ('1','2','3')

I think that we can create a local table (lt_test), insert all the values ('1','2','3') inside this table and then create a query like:


SELECT my_variables FROM my_table INTO my_LocalTable where my_variable NOT IN lt_test

My question is this: Is there a way to put the list of values directly in the SELECT clause and not inside a local table?

Something like:


SELECT my_variables FROM my_table INTO my_LocalTable where my_variable NOT IN ('1','2','3')

Thank you for your time,

Jorge

1 ACCEPTED SOLUTION
Read only

Former Member
3,613

You can create ranges and use that in select clause.

2 REPLIES 2
Read only

Former Member
3,614

You can create ranges and use that in select clause.

Read only

0 Likes
3,613

You can use the query exactly as your example, it will work.

You can also use ar ange, which is a kind of internal table, but if you prefer to put the values direct in your query, it's OK.