On 2000-01-24, Tom Lane mentioned:
> If I don't hear loud hollers very soon, I'm going to eliminate the
> DISTINCT ON "feature" for 7.0. As previously discussed, this feature
> is not standard SQL and has no clear semantic interpretation.
Our documents say that DISTINCT ON is equivalent to GROUP BY. I still
don't see why that wouldn't be true. You can always rewrite
select distinct on a a,b from test
as
select a, xxx(b) from test group by a
where xxx is some aggregate function (presumably min or max).
You can also rewrite
select distinct on a a,b,c from test
as
select a, b, c from test group by a, b, c
or using some aggregates here as well. At least you can control your
results that way.
--
Peter Eisentraut Sernanders väg 10:115
peter_e@gmx.net 75262 Uppsala
http://yi.org/peter-e/ Sweden