Unique - first

From: Robert James <srobertjames(at)gmail(dot)com>
To: Postgres General <pgsql-general(at)postgresql(dot)org>
Subject: Unique - first
Date: 2013-10-27 13:04:42
Message-ID: CAGYyBgjdOCm-OJ7D-2TP8_417f8U5tgKJrtE0q=m_nSFjFsAEg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

I have a table (x,y,z) - I'd like to take the rows with unique x
values - but, when more than one row have the same x value, I want the
one with the minimal z value.

How can I do that? I can imagine doing it with window functions, but
also that regular SQL should be able to do it too.

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Thomas Kellerer 2013-10-27 13:25:46 Re: Unique - first
Previous Message Alan Nilsson 2013-10-27 05:51:12 Re: Segmentation fault: pg_upgrade 9.1 to 9.3: pg_dump: row number 0 is out of range 0..-1