Re: Quick SQL question . . .

From: "Marie G(dot) Tuite" <marie(dot)tuite(at)edisonaffiliates(dot)com>
To: "Peter E(dot) Chen" <pchen3(at)jhmi(dot)edu>, <pgsql-general(at)postgresql(dot)org>
Subject: Re: Quick SQL question . . .
Date: 2002-05-09 20:04:33
Message-ID: IGELKLINGDMODABPOOFECEBNCCAA.marie.tuite@edisonaffiliates.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Try

select identno, count(identno) from some_table group by identno having
count(identno) >=1;

-----Original Message-----
From: pgsql-general-owner(at)postgresql(dot)org
[mailto:pgsql-general-owner(at)postgresql(dot)org]On Behalf Of Peter E. Chen
Sent: Thursday, May 09, 2002 2:39 PM
To: pgsql-general(at)postgresql(dot)org
Subject: [GENERAL] Quick SQL question . . .

Can anyone tell me what is the easiest way for me to tell if a column is
unique or not? I tried using DISTINCT ON and COUNT together in a SELECT
statement, but I can't seem to get the query to work:

SELECT DISTINCT ON (identno) count(identno) FROM some_table;

I was trying to figure out if the # of unique entries for a particular
column is equal to the # of total entries for that column.

Any suggestions?

Peter

---------------------------(end of broadcast)---------------------------
TIP 4: Don't 'kill -9' the postmaster

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Herbert Liechti 2002-05-09 20:06:17 Re: Quick SQL question . . .
Previous Message Fran Fabrizio 2002-05-09 19:54:33 Re: Quick SQL question . . .