Syntax error in SQL statement "SELECT ..."; expected "identifier"
14,006 views
Skip to first unread message
etyr...@gmail.com
unread,
Aug 24, 2015, 1:43:15 PM8/24/15
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to H2 Database
Hi All,
I have a table, policies, that has "id" and "generationId" columns. I want to get a row for "id" with the greatest "generationId" for that "id". My query is as follows:
SELECT * FROM policies JOIN WITH (SELECT id, MAX(generationId) AS maxgen FROM policies GROUP BY id) AS mg ON policies.id = mg.id AND policies.generationId = mg.maxgen
It seems that the database doesn't recognize "maxgen" as an identifier. Below is the error I get. Any suggestions would be appreciated. I am using 1.4.188 beta.