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 Question

RE: SQL Question

From: Vadim Gorbounov <vgorbounov_at_simplyengineering.com>
Date: Wed, 24 Jan 2001 12:22:04 -0500
Message-Id: <10751.127380@fatcity.com>

	Hi, Lee,
	Will this do right job for you?

select distinct HOUSE_KEY, SOURCE_CODE, DATE_OBTAINED, THIRD_PARTY from A) a, b where a.cust_key=b.cust_key
and exists (select null from a c where a.SOURCE_CODE =c.SOURCE_CODE and a.DATE_OBTAINED = c.DATE_OBTAINED and

   a.THIRD_PARTY = c.THIRD_PARTY and a.cust_key <> c.cust_key);         

	Vadim Gorbounov
	Oracle DBA

-----Original Message-----
From: lerobe - Lee Robertson [mailto:LEROBE_at_acxiom.co.uk] Sent: Wednesday, January 24, 2001 9:11 AM To: Multiple recipients of list ORACLE-L Subject: SQL Question

All,  

As you have probably guessed by now, my SQL isn't the srongest so I would appreciate some help if you could.  

Two tables  

Table A



CUST_KEY
SOURCE_CODE
DATE_OBTAINED
THIRD_PARTY
plus other columns  

Table B



CUST_KEY
HOUSE_KEY
other columns.  

What I need to do is find all rows in Table A where columns 2,3 and 4 have the same value (col 1 can be different) and then link to table B and join with cust key to find out which rows have distinct house_keys.  

Data Example  

Table A  

Col1       Col2       Col3       Col4
1            3            3            4
2            3            2            4
3            3            2            4
4            4            4            4
5            5            4            3
6            5            4            3                          in this
example I would only require rows 2 and 3, and 5 and 6.  

Any ideas (other than me going on an SQL writing course !!!).  

Regards  

Lee Robertson
Acxiom
Tel: 0191 525 7344
Fax: 0191 525 7007
Email: lerobe_at_acxiom.co.uk  

The information contained in this communication is confidential, is intended only for the use of the recipient named above, and may be legally privileged. If the reader of this message is not the intended recipient, you are hereby notified that any dissemination, distribution or copying of this communication is strictly prohibited. If you have received this communication in error, please re-send this communication to the sender and delete the original message or any copy of it from your computer system.
--

Please see the official ORACLE-L FAQ: http://www.orafaq.com
--

Author: lerobe - Lee Robertson
  INET: LEROBE_at_acxiom.co.uk

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 Received on Wed Jan 24 2001 - 11:22:04 CST

Original text of this message

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