sql server - Select only maximum value record for multiple rows -
i have 1 table, having records like,
unit rate dateeffected ------------------------------------------- alha ils 2014-03-02 00:00:00.000 alha ils 2014-08-02 00:00:00.000 buck ils 2013-02-14 00:00:00.000 buck ils 2014-03-02 00:00:00.000 buck ils 2014-08-02 00:00:00.000 casc ild 2013-02-14 00:00:00.000 casc ild 2014-03-02 00:00:00.000 casc ild 2014-08-02 00:00:00.000
now, want maximum date value record selection in result table. is,
unit rate dateeffected ------------------------------------------- alha ils 2014-08-02 00:00:00.000 buck ils 2014-08-02 00:00:00.000 casc ild 2014-08-02 00:00:00.000
hope helps.
select unit, rate, max(dateeffected) maxdateeffected tablename group unit,rate
Comments
Post a Comment