Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Mailing Lists -> Oracle-L -> RE: SQL -Can this be done in a single query

RE: SQL -Can this be done in a single query

From: sam d <sam_orafan_at_yahoo.com>
Date: Tue, 14 May 2002 22:18:19 -0800
Message-ID: <F001.00460B9D.20020514221819@fatcity.com>


Bhulu
I made lil changes in the exists subqueries. (Query u sent selected the T1 row present in either t2 or t3 which was correct , but what it also did : t1 row got selected if t1.c2 = t2.c2 even if t2.c3 did not exist in t3.c3 (really complicated to explain in brief) )
foll. query now works:

select t1.c2,t1.c4,t23.c2 c22,t23.c3,t4.c4 c44 from t1,t4,( select t2.c2 c2 ,t2.c3 c3 from t2,t3 where t2.c3=t3.c3) t23
where t1.c4=t4.c4(+)
and t1.c2=t23.c2(+)
and exists
(   

  select 1 from t1 where t1.c2=t23.c2
  union
  select 1 from t1 where t1.c4=t4.c4
)

Thx a lot Bhulu.
Really appreciate all the efforts and time u gave. I only added a brick in structure ,u provided. & Thx all u replied.

-----Original Message-----

From:	S B [SMTP:bhulubhuli_at_yahoo.com]
Sent:	Friday, May 10, 2002 4:14 PM
To:	Multiple recipients of list ORACLE-L
Subject:	RE: SQL -Can this be done in a single query

Sam,

I think this will work. Can you please try it out and let me know if I understood your problem correctly.

select t1.c2,t1.c4,t23.c2,t23.c3,t4.c4
from t1,t4,( select t2.c2 c2 ,t2.c3 c3 from t2,t3 where t2.c3=t3.c3) t23
where t1.c4=t4.c4(+)
and t1.c2=t23.c2(+)
and exists
(
  select 1 from t2 where t2.c2=t1.c2
  union
  select 1 from t4 where t2.c4=t4.c4
)

Regards
Bhulu


Do You Yahoo!?
Yahoo! Shopping - Mother's Day is May 12th! http://shopping.yahoo.com
-- 
Please see the official ORACLE-L FAQ:
http://www.orafaq.com
-- 
Author: S B
  INET: bhulubhuli_at_yahoo.com

Fat City Network Services    -- (858) 538-5051  FAX:
(858) 538-5051
San Diego, California        -- Public Internet access
/ Mailing Lists
--------------------------------------------------------------------
To REMOVE yourself from this mailing list, send an
E-Mail message
to: ListGuru_at_fatcity.com (note EXACT spelling of
'ListGuru') and in
the message BODY, include a line containing: UNSUB
ORACLE-L
(or the name of mailing list you want to be removed
from).  You may
also send the HELP command for other information (like subscribing).

__________________________________________________
Do You Yahoo!?
LAUNCH - Your Yahoo! Music Experience
http://launch.yahoo.com
-- 
Please see the official ORACLE-L FAQ: http://www.orafaq.com
-- 
Author: sam d
  INET: sam_orafan_at_yahoo.com

Fat City Network Services    -- (858) 538-5051  FAX: (858) 538-5051
San Diego, California        -- Public Internet access / Mailing Lists
--------------------------------------------------------------------
To REMOVE yourself from this mailing list, send an E-Mail message
to: ListGuru_at_fatcity.com (note EXACT spelling of 'ListGuru') and in
the message BODY, include a line containing: UNSUB ORACLE-L
(or the name of mailing list you want to be removed from).  You may
also send the HELP command for other information (like subscribing).
Received on Wed May 15 2002 - 01:18:19 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US