Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

using max & min together

Status
Not open for further replies.

rk68

Programmer
Jul 15, 2003
171
IN
The data in table is as follows:
Stage MemberID TimeTaken Score
1 11 26 101
2 11 24 105
1 12 35 120
2 12 44 115
1 13 17 105
2 13 15 107

Output required
2 11 24 105
1 12 35 120
2 13 15 107
How do i use min() & max() in my query to get memberId with less time taken & max score in which stage.

TIA
RAJ
 
got the solution
select a.mbr, min(a.timet) as mint, max(a.score) as mxscr from test a
where a.score in(select max(t.score) from test t where t.mbr=a.mbr)
group by a.mbr
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top