Getting values from other fields using min & max aggregates
From: Gabe Knuth (anonymous_at_discussions.microsoft.com)
Date: 04/07/04
- Next message: Carl: "Deleting Model, MSDBData, Master Databases"
- Previous message: Gabe Knuth: "Get other fields while using min & max aggregate functions"
- Next in thread: Vishal Parkar: "Re: Getting values from other fields using min & max aggregates"
- Reply: Vishal Parkar: "Re: Getting values from other fields using min & max aggregates"
- Reply: Gabe Knuth: "RE: Getting values from other fields using min & max aggregates"
- Messages sorted by: [ date ] [ thread ]
Date: Wed, 7 Apr 2004 12:11:04 -0700
Hi all. 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.
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: Carl: "Deleting Model, MSDBData, Master Databases"
- Previous message: Gabe Knuth: "Get other fields while using min & max aggregate functions"
- Next in thread: Vishal Parkar: "Re: Getting values from other fields using min & max aggregates"
- Reply: Vishal Parkar: "Re: Getting values from other fields using min & max aggregates"
- Reply: Gabe Knuth: "RE: Getting values from other fields using min & max aggregates"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
- Get other fields while using min & max aggregate functions
... 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. ... 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: Cant Add Fields to Form
... Look at the Record Source property of the form. ... the SQL statement
or the saved query before they will be visible to the ... "Jeff Miller" wrote in message
... Hoping I'm posting to the right newsgroup. ... (microsoft.public.access.forms) - Re: Retriving data from DB
... rsRecordset("Name"), which name would I get from the recordset, the first ...
> the fields in your table and generate this sql statement for you (and even ... >
post to an Access newsgroup for help. ... >> tblSchedule and tlbScheduleAdd
... (microsoft.public.inetserver.asp.db) - Re: insert into error
... > Microsoft JET Database Engine ... > I've done a response.write with
the SQL statement and I get this ... it's silly to be forced to worry about delimiters
(let alone ... Please reply to the newsgroup. ... (microsoft.public.inetserver.asp.db) - Re: How to select rows from a mapped protected .MDB and insert into local table
... your concatenation will look like (your tables don't have fields called ...
us the actual sql statement. ... you would have to try it in the Access Query Builder
to be sure. ... You may need to take this to an Access newsgroup to get Jet-specific ...
(microsoft.public.data.ado)