472,119 Members | 1,806 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,119 software developers and data experts.

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 2028
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 leo001 | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.