sql - MSSQL - Grouping Results using MAX() -
i have dataset;
did num 11 3 11 4 11 5 13 9 13 11 45 3 45 8 99 44 99 78 99 53
i want this.
did num 11 5 13 11 45 8 99 78
list id's , show id's 'num' largest number group of id's
my attempt here doesnt quite work out. http://sqlfiddle.com/#!9/1a47f/1
you right, grouped wrong column:
select did, max(num) data group did
see here: http://sqlfiddle.com/#!9/1a47f/3
Comments
Post a Comment