469,638 Members | 1,560 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,638 developers. It's quick & easy.

select question

got a table with (class, name, exam, score) fields.

To find max(score) for exam that starts with letter 'm'
grouped by class and name,did:

select max(score) from #temp where exam like 'm%'
group by class,name

this work only for selecting max(score) from #temp.
How to select all columns and max(score) at the same time,
how to do select *,max(score) from #temp?.
when tried, it gave multiple reults, error.

--
Sent by 3 from yahoo piece of com
This is a spam protected message. Please answer with reference header.
Posted via http://www.usenet-replayer.com
Jul 20 '05 #1
1 1962
Hi

It is better to post DDL (Create table statements) example data (as insert
statements), your attempted statements and expected output, rather than a
verbose description as this removes all ambiguities.

You could try

SELECT Class, Name, Exam, ( SELECT MAX(Score) FROM #Temp T WHERE T.Class =
D.Class AND T.Name = D.Name ) as MaxScore
FROM #Temp D
WHERE D.Exam like 'm%'

John
"al********@yahoo.com" <u1********@spawnkill.ip-mobilphone.net> wrote in
message news:l.*********************@[63.127.215.130]...
got a table with (class, name, exam, score) fields.

To find max(score) for exam that starts with letter 'm'
grouped by class and name,did:

select max(score) from #temp where exam like 'm%'
group by class,name

this work only for selecting max(score) from #temp.
How to select all columns and max(score) at the same time,
how to do select *,max(score) from #temp?.
when tried, it gave multiple reults, error.

--
Sent by 3 from yahoo piece of com
This is a spam protected message. Please answer with reference header.
Posted via http://www.usenet-replayer.com

Jul 20 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

3 posts views Thread by Tcs | last post: by
1 post views Thread by Christopher DeMarco | last post: by
5 posts views Thread by GTi | last post: by
2 posts views Thread by Eitan | last post: by
reply views Thread by gheharukoh7 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.