09-17-2016 03:54 PM - edited 09-17-2016 04:07 PM
suppsoe I have the following table:
First I would like to get the rows where the id has a num = 1 and this is easily done:
if num = 1;
and I get the following data:
Now what I want is to get the ids 3,4 and 5 into a list like this when I run the following pseudo-code:
if id in list; I know this line has a wrong syntax, its just for the purpose of illustration
I get the final data:
So this data has all the original ids that have a num=1
09-17-2016 04:25 PM
thanks for the reply, but is it possible to have a solution with the list becasue the example that I have put is an oversimplification and my real data is more complicated than that, and it will be really helpful if I could create a data table by inputting a list.
09-17-2016 08:37 PM - edited 09-17-2016 08:38 PM
I managed to put the values in a list in the following way:
select /*distinct*/ id
into :id separated by ', '
Then I wanted to use your code, which works greatly as it is, to do something like this:
Where id in ( select &id);
But I got an error message. Is it even possible to use list macro variables in this way?
Need further help from the community? Please ask a new question.