MySQL Return all unique values in a column along with the last date associated with each -
i have table relative
trying pull unique id
s first , last date associated each one. far, have query below, returns each unique id
along first date in table associated each id
. how modify query (or run second one) return each unique id
along last date in table associated id
?
select `id`, `date` `relative`.`datatable` group `id`
this basic aggregation query:
select `id`, min(`date`), max(`date`) `relative`.`datatable` group `id`;
and, @rogoas points out, query not guaranteed return minimum date. return arbitrary date each id.
Comments
Post a Comment