
Untitled
By: a guest on
Jun 13th, 2012 | syntax:
None | size: 0.48 KB | hits: 36 | expires: Never
SQL query that works in postgre 9.1 :
SELECT sum(count), date_part('WEEK', tcreated) as week
FROM usulTests
GROUP BY week
ORDER BY week DESC
And the JPA (eclipselink 2.3.2) version that doesn't work :
SELECT SUM(b.count), FUNC('date_part','WEEK', b.tcreated) AS week FROM BidLEntreprise b GROUP BY week ORDER BY week
The exception :
org.postgresql.util.PSQLException: ERROR: column "usulTests.tcreated" must appear in the GROUP BY clause or be used in an aggregate function