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 query

Re: sql query

From: Veera Prasad <vprasad_at_olf.com>
Date: Wed, 31 Jan 2001 18:15:31 -0500
Message-Id: <10758.127999@fatcity.com>


try this select statement ....

select id from table1 where id in (select a.id from table2 a group by a.id having count(*) > 1);

Veera

Ravindra Basavaraja wrote:

> Hi,
>
> I am having problem in writing a query.May be this is a elementary Q but I
> need help
>
> Table 1:
> id value
> -- ------
> a 3
> b 3
> c 3
> d 3
> e 3
> id is primary key
>
> Table 2:
> a_id value
> ----- ------
> a 3
> b 3
> c 3
> d 3
> e 3
> a 0
> b 4
> a 3
> b 3
> c 2
> c 3
> a_id is foreign key referencing Table1(id)
>
> I want to display the records that are being repeated comparing with the id
> in table 1
> where value=3 in the second table i.e
> the o/p should be id 'd' is not being repeated
>
> id value
> -- ------
> a 3
> b 3
> c 3
>
> How do i write the query
>
> Thanks
>
> ravindra
>
> --
> Please see the official ORACLE-L FAQ: http://www.orafaq.com
> --
> Author: Ravindra Basavaraja
> INET: ravindra_at_sentica.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 Jan 31 2001 - 17:15:31 CST

Original text of this message

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