how to do this select? - Mailing list pgsql-general

From Yi Zhao
Subject how to do this select?
Date
Msg-id 1235024832.3155.12.camel@localhost.localdomain
Whole thread Raw
In response to PostgreSQL for a mission critical system  (Andrés Robinet <agrobinet@gmail.com>)
Responses Re: how to do this select?
List pgsql-general
hi, all, I have a table in postgresql which have 2 columns like this:
a|b
------
X A
X A
Y A
D B
H B
E B
D B
P C
when I do select and order by, I got this:
 a | b
---+---
 X | A
 X | A
 Y | A
 D | B
 H | B
   | B
 D | B
 P | C

I want to get the only 2 rows(limit or random) if the column "b" have
the same value. so, the result of the above is
a | b
---+---
X | A
X | A
D | B
H | B
P | C

how to do that, thanks all!


pgsql-general by date:

Previous
From: "Joshua D. Drake"
Date:
Subject: Re: Removing a corrupt database by hand
Next
From: "Sameer Mahajan"
Date:
Subject: postgres wish list