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 |
|
amirs
Constraint Violating Yak Guru
260 Posts |
Posted - 2010-04-18 : 23:31:39
|
| Dear Memberfollowing is my table structurestu_name subject marks A English 30 A Science 20 A Computer 25 B English 26 B Science 30 B Computer 40 C English 25 C Science 20 C Computer 23I have write a select query to select stu_name and maximum sum of total marks i have display following resultsstu_name MarksB 96so how write a select querythanks in advance |
|
|
khtan
In (Som, Ni, Yak)
17689 Posts |
Posted - 2010-04-18 : 23:35:12
|
[code]select top (1) stu_name, sum(marks)from yourtablegroup by stu_nameorder by sum(marks) desc[/code] KH[spoiler]Time is always against us[/spoiler] |
 |
|
|
amirs
Constraint Violating Yak Guru
260 Posts |
Posted - 2010-04-19 : 00:01:18
|
| Thanks Khtanit is very good replaybcoz i have create temp table and then select max marks and studentthnaks ones again |
 |
|
|
|
|
|