Search Postgresql Archives

Remove duplicate rows

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

 



Hello,

I need to remove duplicates rows from a subquery but order these
results by a column what is not selected. There are logically two
solutions but no works.

SELECT DISTINCT sub.foo FROM (SELECT ...) AS sub ORDER BY sub.bar
ERROR:  for SELECT DISTINCT, ORDER BY expressions must appear in select list

SELECT sub.foo FROM (SELECT ...) AS sub GROUP BY sub.foo ORDER BY sub.bar
ERROR: column "sub.bar" must appear in the GROUP BY clause or be used
in an aggregate function

Does anybody know how to remove duplicate rows from a subquery and order
these results by a column what is not selected but exists in a subquery?

Thanks for any advice,

J.N.



[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