Re: How to do this query?

From: Mike Schuler <mike_schuler_at_mindlink.bc.ca>
Date: 1995/04/26
Message-ID: <mike_schuler.11.000BBCFD_at_mindlink.bc.ca>#1/1


In article <D7Lo0D.JI4_at_lanier.com> dvick_at_lanier.com (Don Vick) writes:
>Newsgroups: comp.databases.oracle
>Path:
>news.mindlink.net!vanbc.wimsey.com!scipio.cyberstore.ca!math.ohio-state.edu!howl
>and.reston.ans.net!swrinde!emory!slammer!sd!dvick
>From: dvick_at_lanier.com (Don Vick)
>Subject: Re: How to do this query?
>References: <0098F132.BC764E1C_at_vms.csd.mu.edu> <3n3rij$8qs_at_viking.cs.ubc.ca>
>Message-ID: <D7Lo0D.JI4_at_lanier.com>
>Sender: Don Vick <dvick_at_lanier.com>
>Organization: Lanier Worldwide, Tucker, GA
>Date: Tue, 25 Apr 1995 16:48:12 GMT
>Lines: 25

>>In article <0098F132.BC764E1C_at_vms.csd.mu.edu>,
>> <5603liul_at_vms.csd.mu.edu> wrote:
>>> I wonder how I can do this query?
>>>
>>> Assume I have a table, say A. In A, there are two columes,
>>>Say, B, C. Let's assmue it looks like this.
>>> B C
>>> --- ---
>>> 1 2
>>> 2 3
>>> 3 3
>>> 4 6
>>>
>>> How can we find the columns with duplicate C's? Here,
>>>it is (2,3) and (3,3).
 

>I think this will work:
 

> select b,c from a where c in
> (select c from a group by c having count(*) > 1)
 

>Don
>--------------------------------------------------------
>Donald E. Vick (dvick_at_lanier.com, dvick_at_crl.com)
>Voice: (404) 493-2194 Fax: (404) 493-2399

The "correct" way to do this is:
select d1.b
from A d1
where exists

Mike Schuler - software developer
IBX datasystems limited
Vancouver - CANADA Received on Wed Apr 26 1995 - 00:00:00 CEST

Original text of this message