sql server - How to get a max value of a column in SQL? -


i want find max value of column. have following table structure:

orderid | taskid  | serialno 1       |   1     |   1 1       |   1     |   2 1       |   2     |   1 1       |   2     |   2 1       |   2     |   3 2       |   1     |   1 2       |   2     |   1 2       |   2     |   2 

from above table want following result every orderid , taskid, display max value:

serialno 2 3 1 2 

by using max getting orderid , taskid well, not intended result. using sql server. how intended result?

select orderid, taskid, max(serialno) mytable group orderid, taskid 

if want max(serialno), can omit other 2 columns in select.


Comments

Popular posts from this blog

java - Andrioid studio start fail: Fatal error initializing 'null' -

android - Gradle sync Error:Configuration with name 'default' not found -

StringGrid issue in Delphi XE8 firemonkey mobile app -