View previous topic :: View next topic
|
Author |
Message |
ramsri
Active User
Joined: 18 Oct 2008 Posts: 380 Location: India
|
|
|
|
Hi,
I have written below query in SPUFI to fetch details from a table in our DB successfully.
Code: |
SELECT * FROM DM01.ORDER
WHERE (ORD_KEY,ORD_NBR) = ('X42',' XXXX42')
OR (ORD_KEY,ORD_NBR) = ('X43',' XXXX43')
WITH UR;
|
I would like to know how to use IN instead of writing it separately?
Thanks. |
|
Back to top |
|
|
Marso
REXX Moderator
Joined: 13 Mar 2006 Posts: 1353 Location: Israel
|
|
|
|
In this case, you can't use IN
If you had:
Code: |
WHERE (ORD_KEY,ORD_NBR) = ('X42',' XXXX42')
OR (ORD_KEY,ORD_NBR) = ('X42',' XXXX43') |
then you could use
Code: |
WHERE ORD_KEY = 'X42' AND ORD_NBR IN (' XXXX42',' XXXX43') |
|
|
Back to top |
|
|
ashimer
Active Member
Joined: 13 Feb 2004 Posts: 551 Location: Bangalore
|
|
|
|
Your where clause can be broken down as
Code: |
WHERE
(ORD_KEY = 'X42' AND ORD_NBR = ' XXXX42' )
OR
(ORD_KEY = 'X43' AND ORD_NBR = ' XXXX43' )
|
cannot use IN clause here ... |
|
Back to top |
|
|
Marso
REXX Moderator
Joined: 13 Mar 2006 Posts: 1353 Location: Israel
|
|
|
|
In fact, I tried:
Code: |
WHERE (ORD_KEY,ORD_NBR) IN ( ('X42',' XXXX42') , ('X43',' XXXX43') ) |
but couldn't make it work.
SQLCODE -216 that I received when playing with the values leads me to think that something like that may be possible. |
|
Back to top |
|
|
ramsri
Active User
Joined: 18 Oct 2008 Posts: 380 Location: India
|
|
|
|
Guys, thanks for all your replies. |
|
Back to top |
|
|
|