I am fetching records from my "record" table. "record" table has many columns tow of which are
- client_id, foreign key mapping to client table.
- creation_date , date of record creation
I would like to do a query on this table , but I would like to fetch only one record per client(latest creation_date record has preference).
Will following work?
select r.id,r.xx,r.yy
group by(r.client_id),r.creation_date
from record r
order by creation_date desc
I tried above and seems records fetched are not of latest creation dates. Hope my question is clear