postgresql - Is it possible to get a function result with columns which are not in the group by (SQL)? -
I am trying to get the final registration date of a course, but I id Thar Max of the record is a function, so I should use the group from id , which I do not want, because the result is very different (only one record per ID per every record).
What's the way to manage a query like this ?:
SELECT id, MAX (registration_date) as a registration form;
Because it returns an error and I have to do this to avoid it:
SELECT id, MAX (registration_date) AS in the form of registration Group ID from registration ID;
And I do not want the result of the last one.
You can use the window function for:
SELECT id FROM (SELECT id, RANK) (override registration_dated DESC from the course of RCom) WHERE rk = 1
Comments
Post a Comment