Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
AskSQLTeam
Ask SQLTeam Question
0 Posts |
Posted - 2002-10-18 : 09:15:54
|
| robert writes "Here is my tableform_id type1 type2 qty1 10 S 51 10 S 11 10 S 12 29 M 12 29 M 63 10 S 23 10 S 44 12 M 14 12 M 05 29 M 26 10 S 3and I looking for a select statement that will give me the highest qty within each form ID along with type1,type2 and qtythe result should look like:form_id type1 type2 qty1 10 S 52 29 M 63 10 S 44 12 M 15 29 M 26 10 S 3ThanksRob" |
|
|
robvolk
Most Valuable Yak
15732 Posts |
Posted - 2002-10-18 : 09:16:42
|
| SELECT form_id, type1, type2, MAX(qty) AS qtyFROM myTableGROUP BY form_id, type1, type2 |
 |
|
|
|
|
|