This is a discussion on Help with SELECT query within the SQL Server forums, part of the Microsoft SQL Server category; --> My SELECT query returns a data set, one column of which contains a set of values corresponding to the ...
| |||||||
| Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| ||||
| My SELECT query returns a data set, one column of which contains a set of values corresponding to the same date. I.e. for each date in column "Date", I have a set of numbers in column "Numbers". However, I am only interested in getting the largest value in column "Numbers" corresponding to each value in column "Date". How do I do that? Thanks, Marco |
| |||
| mdi00@hotmail.com (Marco) wrote in news:e5f1d809.0411190312.c9f8b07 @posting.google.com: > My SELECT query returns a data set, one column of which contains a set > of values corresponding to the same date. I.e. for each date in column > "Date", I have a set of numbers in column "Numbers". However, I am > only interested in getting the largest value in column "Numbers" > corresponding to each value in column "Date". How do I do that? > Thanks, > > Marco > SELECT "Date", MAX("Numbers")AS "Largest number" FROM sometable GROUP BY "Date" |
| ||||
| Marco wrote: > My SELECT query returns a data set, one column of which contains a set > of values corresponding to the same date. I.e. for each date in column > "Date", I have a set of numbers in column "Numbers". However, I am > only interested in getting the largest value in column "Numbers" > corresponding to each value in column "Date". How do I do that? > Thanks, > > Marco Look up MAX and GROUP BY. |
| Thread Tools | |
| Display Modes | |
|
|