Thursday, December 1, 2022

Max group by SQL query with all columns

 select * from icms_employee e inner join  (select max(id) as maxid , Discipline from icms_employee group by Discipline ) t on  e.id = t.maxid


reference:- https://stackoverflow.com/questions/6860746/sql-selecting-multiple-columns-based-on-max-value-in-one-column

No comments:

Post a Comment