Re: How to do this query?

From: Furs Serge <sef_at_kpbank.kemerovo.su>
Date: 1995/04/20
Message-ID: <199504200754.OAA26054_at_mgw.hq.kem>#1/1


5603liul_at_vms.csd.mu.edu writes:
>Dear netters:
> 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).
>
Simply:

 SELECT B,C FROM A T1 WHERE 1 < (SELECT COUNT(*) FROM A T2 WHERE T2.C = T1.C)

It will be better if exist index on C.

Serge Furs. Received on Thu Apr 20 1995 - 00:00:00 CEST

Original text of this message