MySQL Return all unique values in a column along with the last date associated with each -


i have table relative trying pull unique ids 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

Popular posts from this blog

java - Run a .jar on Heroku -

java - Jtable duplicate Rows -

validation - How to pass paramaters like unix into windows batch file -