The following query worked in Sybase SQL: –
select id, version from local_tbl
group by id
having version < max(version)
It gets me all id’s and versions except for the maximum.
When i try the same query in Postgres 9.1, i get the following error message: –
Error: ERROR: column "local_tbl.version" must appear in the GROUP BY clause or be used in an aggregate function
I can’t put the version in the group by as i want all of the versions for an id.
How can i do the equivalent?
Try: