Get other fields while using min & max aggregate functions
From: Gabe Knuth (anonymous_at_discussions.microsoft.com)
Date: 04/07/04
- Next message: Gabe Knuth: "Getting values from other fields using min & max aggregates"
- Previous message: Vishal Parkar: "Re: Number to Date."
- Messages sorted by: [ date ] [ thread ]
Date: Wed, 7 Apr 2004 12:01:04 -0700
Hi all. I tried to search the forum for this, but I'm not entirely sure how to phrase it to get the best results, so I figured I'd post and hope someone can help me out.
I've got a SQL statment that retrieves the minimum and maximum values from the Score field in a table called Scores (original, I know). What I'd like to do is retreive another field called PersonID for each of the two results I get. Basically, I'd like to have the output look like this:
Record Score_Min Score_Min_PersonID Score_Max Score_Max_PersonID
1 ........41...........5.......................... 69............3
The current SQL statement I have is below, and works great for returning only the min and max scores.
SELECT Score_Min=MIN(dbo.Scores.Score), Score_Max=MAX(dbo.Scores.Score) FROM dbo.Scores WHERE Score <> 0
Thanks in advance for your help.
Gabe
- Next message: Gabe Knuth: "Getting values from other fields using min & max aggregates"
- Previous message: Vishal Parkar: "Re: Number to Date."
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
- Getting values from other fields using min & max aggregates
... I tried to search the newsgroup for this, but I'm not entirely sure how to phrase
it to get the best results, so I figured I'd post and hope someone can help me out. ... The current
SQL statement I have is below, and works great for returning only the min and max scores. ...
Gabe ... (microsoft.public.sqlserver.mseq) - Re: Access and Sharepoint
... MY point is being misinterpreted - I submitted a post to a forum and an MVP ...
I've seen responses on this forum that actually explained why something would ... >that
expresses in one short phrase what science is all about. ... >> Suck them
and see. ... (microsoft.public.access.gettingstarted) - Re: f*ck.
... Jim Calhoun team for christsakes. ... practically every word is someone's schtick.
... so without ever knowing who harper was or what phrase he came up with. ... picked
it up from this forum and recognized that he did.....as it is ... (rec.sport.football.college) - Re: Combo Box Problem
... from within the forum, in order to help the person posting *and* others who
... >> query? ... a SQL statement? ... (microsoft.public.access.gettingstarted) - Re: Configuration question
... commonly used version of the same phrase is "up yours". ... which is still better
then flying economy with Delta. ... Questions are asked after you proper personal effort
on ... but you're on the wrong forum. ... (comp.databases.oracle.server)