MVSFORUMS.com A Community of and for MVS Professionals
View previous topic :: View next topic
Author
Message
joergensen Beginner Joined: 05 Nov 2003 Posts: 9 Topics: 7
Posted: Thu Nov 05, 2015 1:52 am Post subject: IN list several columns
how to get this working ?:
select * from tab1 where (col1,col2) in ((1,2),(1,3),(1,4).......)
(select from sysdummy1 with union works, but i think it's a bad solution)
this Works:
select * from tab1 where (col1,col2) in (select col1,col2 from tab2);
greatings joergensen
Back to top
kolusu Site Admin Joined: 26 Nov 2002 Posts: 12358 Topics: 75 Location: San Jose
Posted: Thu Nov 05, 2015 9:13 am Post subject: Re: in list several columns
joergensen wrote: how to get this working ?:
select * from tab1 where (col1,col2) in ((1,2),(1,3),(1,4).......)
(select from sysdummy1 with union works, but i think it's a bad solution)
this Works:
select * from tab1 where (col1,col2) in (select col1,col2 from tab2);
greatings joergensen
If col1 and Col2 are having the same attributes you can use Concatenation of the columns and treat it as a single column.
Something like this
Code:
SELECT *
FROM TAB1
WHERE COL1 CONCAT COL2 IN (12,13,14)
;
_________________ Kolusu - DFSORT Development Team (IBM)
DFSORT is on the Web at:
www.ibm.com/storage/dfsort
www.linkedin.com/in/kolusu
Back to top
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum