"Harald Fuchs" <hf0114x(at)protecting(dot)net> writes:
> If you want to select both columns, but have uniqueness over the first
> only, you can use a derived table:
>
> SELECT tbl.name, tbl.comment
> FROM tbl
> JOIN (SELECT name FROM tbl GROUP BY name HAVING count(*) = 1) AS t
> ON t.name = tbl.name
>
Or use the first() aggregate since you know there's only going to be one
anyways:
select name, first(comment)
from tbl
group by name
having count(*) = 1
--
Gregory Stark
EnterpriseDB http://www.enterprisedb.com
Ask me about EnterpriseDB's PostGIS support!