PostGres Error When Using Distinct : postgres ERROR: could not identify an ordering operator for type record

这一生的挚爱 提交于 2019-12-05 22:41:14

As I think you've worked out, you don't want the parentheses after DISTINCT. They look like they should be parameterising DISTINCT, but they actually serve to make the query return a single column of record type instead of multiple columns. The DISTINCT operator then tries to work on the record and finds that you've not defined an ordering on that record.

If you want DISTINCT to work on a subset of your return values, use DISTINCT ON.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!