PC Review


Reply
Thread Tools Rate Thread

Determine Max Record

 
 
Joe
Guest
Posts: n/a
 
      9th Feb 2011
I have 4 fields in a table: Need ID, Cost ID, Estimated Hours, and
Ranking.

Sample data would be:
CostID NeedID SumEstimateHours Ranking
359 372 150 2
360 372 50 1

I need to write a query that will return the Max ranking record - in
this case the Ranking = 2 record.
 
Reply With Quote
 
 
 
 
John W. Vinson
Guest
Posts: n/a
 
      9th Feb 2011
On Wed, 9 Feb 2011 05:35:33 -0800 (PST), Joe <(E-Mail Removed)> wrote:

>I have 4 fields in a table: Need ID, Cost ID, Estimated Hours, and
>Ranking.
>
>Sample data would be:
>CostID NeedID SumEstimateHours Ranking
>359 372 150 2
>360 372 50 1
>
>I need to write a query that will return the Max ranking record - in
>this case the Ranking = 2 record.


A Subquery will do this for you. Create a query based on the table and put

=(SELECT Max([Ranking] FROM yourtable)

on the Ranking field. The parentheses are eseential; you can put additional
criteria within the parentheses if needed; e.g. if you want just the maximum
ranking for a particular NeedID, the subquery might be

=(SELECT Max([Ranking] FROM yourtable AS X WHERE X.NeedID = yourtable.NeedID)

to make it a "correlated" subquery.
--

John W. Vinson [MVP]
Microsoft's replacements for these newsgroups:
http://social.msdn.microsoft.com/For...-US/accessdev/
http://social.answers.microsoft.com/.../en-US/addbuz/
and see also http://www.utteraccess.com
 
Reply With Quote
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Determine record in VB code Gord Microsoft Access Getting Started 2 18th Oct 2008 05:33 AM
How to determine if subform has record or not SF Microsoft Access 1 2nd May 2007 05:04 AM
How To Determine New Record =?Utf-8?B?QUtBIFNwYXdu?= Microsoft Access Form Coding 2 10th Jul 2005 03:45 PM
Determine if a corosponding record exist for a master record on a subreport Jasonm Microsoft Access Reports 5 29th Jan 2005 02:59 AM
How can I determine my Current Record? michaaal Microsoft Access VBA Modules 1 14th Jun 2004 03:36 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 07:54 PM.