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

Home -> Community -> Usenet -> c.d.o.misc -> Re: How can I set up this select?

Re: How can I set up this select?

From: Jerry Gitomer <jgitomer_at_erols.com>
Date: Sun, 02 Apr 2000 23:27:00 -0400
Message-ID: <38E80F84.3B3B2982@erols.com>


Ken Sproule wrote:
>
> Thanks for your help.
>
> Say I have 2 tables. One is a holding table with either new data to be
> inserted or updates to already existing data.
>
> tableA_data_to_put_into_TableB
> Name serial
>
> tableB_to_be_updated_or_inserted_into
> Name (PK_1) serial(PK_2)
>
> Notice that TableA has no constraints. Thus an attempt to insert into
> TableB if "serial" is duplicated will of course fail.
>
> My question is how to construct a select statement that will list all
> the records in tableA that have the same name and serial as in TableB
> --- but I don't know ahead of time the names or serials to put into
> the select's where clasuse.
>
> Can someone help me?
>
> Best,
>
> Ken Sproule
> kenmn_at_tds.net

        How about:

	SELECT name, serial FROM A
	INTERSECT
	SELECT name, serial FROM B;

--
Jerry Gitomer
Once I learned how to spell DBA, I became one Received on Sun Apr 02 2000 - 22:27:00 CDT

Original text of this message

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