Skip to content Skip to sidebar Skip to footer

Postgresql Grouping Error

I got this error when i was executing this query on PostgreSQL: SQLSTATE[42803]: Grouping error: 7 ERROR: column 'posts.title' must appear in the GROUP BY clause or be used in an

Solution 1:

The problem is, that in PostgreSQL you need to add all the columns you want to have in your select to your group by.

so your statement should be like

SELECT*FROMtableGROUPBY column1, column2...

Solution 2:

Try this.

SELECTDISTINCT*FROM 
(SELECTROW_NUMBER() OVER(PARTITIONBY  "posts"."id" ORDERBY   "posts"."id") No, posts.*FROM "posts"  ) AS T1 WHERE T1.NO =1ORDERBY "id" DESC LIMIT 20OFFSET0

Post a Comment for "Postgresql Grouping Error"