以后出现的所有重复项(rational
在这种情况下按顺序排列)都应该被删除。但以下查询不起作用:
SELECT DISTINCT ON(postcards.id) postcards.id, postcards.title, rational
FROM
(
SELECT postcards.id, postcards.title,
some_complex_condition as rational
FROM postcards
ORDER BY rational
) as postcards
我希望这取决于订购,但事实并非如此。似乎需要设置一些优先级DISTINCT ON
。可以做Postgresql
吗?