i have mysql-table, containing these data:
idpk groupidfk 1 1 2 1 3 2 4 2 5 1
i'm looking way group 2nd column values , display highest value first column in group. in case, should return these entries:
idpk groupidfk 5 1 4 2
does description make sense? , if so, can please me out?
this query rows sorted groupidfk:
select max(idpk) idpk, groupidfk table group groupidfk;
if need order idpk below version:
select max(idpk) idpk, groupidfk table group groupidfk order idpk desc;
Comments
Post a Comment