use select p, max(item) over (partition by p) from item where item='D' -- Sent from: http://www.postgresql-archive.org/PostgreSQL-admin-f2076596.html
use select p, max(item) over (partition by p) from item where item='D' -- Sent from: http://www.postgresql-archive.org/PostgreSQL-admin-f2076596.html