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.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 select a row using maax func...

Author  Topic 

younas02
Starting Member

28 Posts

Posted - 2012-06-27 : 01:38:03
i want to select all columns of a row using max() function. for example
i m using
select testname,max(marks) from table where name='ali' group by testname it gives corect result. i.e, rows with maximum marks in different subject. but when i use more than 2 column it gives all row where name='ali'.
considering 6 total records with 2 records of each subject mean 3, subjects 2 test result records of each.
i want to select rows with maximum marks . in case of 3 subjects i require only 3 rows with maximum marks
plz help me......

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2012-06-27 : 03:32:02
can you explain what do you mean by "select all columns of a row using max() function"

Please post some sample data and the expected result


KH
[spoiler]Time is always against us[/spoiler]

Go to Top of Page

meckeard
Starting Member

4 Posts

Posted - 2012-06-27 : 18:13:36
That query works fine for me when I create a table with 2 columns (TestName & Marks).

Like khtan stated, post more details and maybe we can assist.

Mark
Go to Top of Page
   

- Advertisement -