selecting rows based on unique fields in a column

From: John Siggins <j-siggins(at)blueyonder(dot)co(dot)uk>
To: pgsql-novice(at)postgresql(dot)org
Subject: selecting rows based on unique fields in a column
Date: 2003-11-05 11:52:30
Message-ID: 3FA8E47E.6020007@blueyonder.co.uk
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

Hi,
Is there an easy way to select all rows which have a single entry in a
particular column from those that have multiple entries.

At present I'm using

select reqitem from lasting
group by reqitem having count(reqitem) = 1;

But this gives me only reqitem column and I want the rest of the row!

I can see how to do this by creating another table updating it with the
above and then selcting into the table all the rest of the row, but is
there an easier way, have I missed something obvious?

Thanks for any response.

John S

Responses

Browse pgsql-novice by date

  From Date Subject
Next Message Manfred Koizar 2003-11-05 14:02:18 Re: selecting rows based on unique fields in a column
Previous Message Damon 2003-11-05 11:41:17 How to know column constraints via system catalog tables