Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

select where id in list

Hi,

I've a select statement of the following syntax:

Table:

load *

from table.qvd

where id = 1 or 2 or 3;

Because the list of applicable IDs is considerably long I'd like to simplify the statement to something like

Table:

load *

from table.qvd

where id in IDlist;

Any ideas on how to achieve this?!

1 Solution

Accepted Solutions
MK_QSL
MVP
MVP

Where Exists (IDlist, ID)

Where IDlist is a table like below

Load * Inline

[

     IDlist

     1

     2

     3

];

View solution in original post

6 Replies
MK_QSL
MVP
MVP

Where Exists (IDlist, ID)

Where IDlist is a table like below

Load * Inline

[

     IDlist

     1

     2

     3

];

tresesco
MVP
MVP

Exists() ?

Not applicable
Author

might be you can use

where Id >=1 and <=50

if its in sequence!


Not applicable
Author

Hi Manish,

this is exactly what I was looking for!

Now instead of using inline tables I'll look if I can just import the relevant ID's from my source files.

Thanks a bunch!

Not applicable
Author

Hi Manish,

one more question.. although the script runs..

the Where Exists(IDlist, ID) statement doesn't yield the return that

where id = 1 or 2 or 3 does...

In fact it seems the exists function doesn't find any matches?

MK_QSL
MVP
MVP

Try this sample..

Load * Inline

[

  IDList

  1

  2

  3

];

Load * Inline

[

  Customer, ID

  A, 1

  B, 2

  C, 3

  D, 4

  E, 5

  F, 6

]

Where Exists (IDList, ID);

Drop Field IDList;