Search Postgresql Archives

how to do this select?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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!


-- 
Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux