|
RSS Feed - WebSphere MQ Support
|
RSS Feed - Message Broker Support
|
 |
|
Multiple IN's in WHERE IN search condition |
« View previous topic :: View next topic » |
Author |
Message
|
billybong |
Posted: Tue Oct 04, 2005 11:26 pm Post subject: Multiple IN's in WHERE IN search condition |
|
|
 Disciple
Joined: 22 Jul 2005 Posts: 150 Location: Stockholm, Sweden
|
More of a database question I guess, but is it possible to use multiple where in's in nested select queries? I was considering something like this:
WHERE x AND y IN(SELECT table1.x, table2.y FROM ......etc )
Or do I have to write separate WHERE conditions for each, like this:
WHERE x IN(SELECT etc....)
AND y IN(SELECT etc....)
Please dont give me any RTFM answers, and if you must, please be nice  |
|
Back to top |
|
 |
mgk |
Posted: Wed Oct 05, 2005 12:08 am Post subject: |
|
|
 Padawan
Joined: 31 Jul 2003 Posts: 1642
|
Hi,
Well did you try it before you posted? Which version / csd are you trying to do this? (SELECT is MUCH better in V5 than in V2.1 and also is MUCH better in V6 than in V5, so by definition is a whole universe better in V6 than in V2.1 ).
It be ok in V5 and V6, I have not tried it myself though...
Regards, _________________ MGK
The postings I make on this site are my own and don't necessarily represent IBM's positions, strategies or opinions. |
|
Back to top |
|
 |
billybong |
Posted: Wed Oct 05, 2005 12:17 am Post subject: |
|
|
 Disciple
Joined: 22 Jul 2005 Posts: 150 Location: Stockholm, Sweden
|
Ive tried using both AND and , to separate and neither works.
Right now I have to do two separate queries using exactly the same nested SELECT cases in order to tie the query together. It works, but it seems such an ineffective way of doing it.
BTW, I'm using version 5 csd 3 |
|
Back to top |
|
 |
mgk |
Posted: Wed Oct 05, 2005 1:12 am Post subject: |
|
|
 Padawan
Joined: 31 Jul 2003 Posts: 1642
|
Can you post your actualy ESQL please _________________ MGK
The postings I make on this site are my own and don't necessarily represent IBM's positions, strategies or opinions. |
|
Back to top |
|
 |
billybong |
Posted: Wed Oct 05, 2005 1:41 am Post subject: |
|
|
 Disciple
Joined: 22 Jul 2005 Posts: 150 Location: Stockholm, Sweden
|
SET Environment.Variables.Temp.Bookings[] =
(SELECT AKTTAG0.REF_NO, AKTTAG0.INSTR_SEQ_NO
FROM Database.AKTTAG0 AS AKTTAG0, Database.AKTTAF0 AS AKTTAF0
WHERE AKTTAG0.REF_NO = AKTTAF0.REF_NO
AND SUBSTRING(AKTTAG0.acct_no FROM 5 FOR 2) = Environment.Variables.Bookings.BookingGroup[I].ACCT
AND AKTTAG0.DEB_CRE_CODE = Environment.Variables.Bookings.BookingGroup[I].DEB_CRE_CODE
AND AKTTAG0.STATUS = 'Pending'
AND AKTTAF0.CURR_CODE = Environment.Variables.Bookings.BookingGroup[I].CURR_CODE);
UPDATE Database.AKTTAG0 as AKTTAG0
SET REPORT_ID = Environment.Variables.Bookings.BookingGroup[I].REPORT_ID
WHERE AKTTAG0.REF_NO = Environment.Variables.Temp.Bookings.REF_NO
AND AKTTAG0.INSTR_SEQ_NO = Environment.Variables.Temp.Bookings.INSTR_SEQ_NO;
As you can see I'm using a temporary environment tree to store the keys in when it would be much simpler to use a nested select statement in the update. |
|
Back to top |
|
 |
|
|
 |
|
Page 1 of 1 |
|
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
|
|
|
|