Print Page | Close Window

SubQuery.mdb ( beginner )

Printed From: Roger's Access Library
Category: Roger's Access Library
Forum Name: Roger's Download Samples
Forum Description: A compendium of Microsoft Access 97 and 2000+ routines, each separated into its own sample database.
Printed Date: 21 Sep 2020 at 8:54pm
Software Version: Web Wiz Forums 12.03 -

Topic: SubQuery.mdb ( beginner )
Posted By: Roger Carlson
Subject: SubQuery.mdb ( beginner )
Date Posted: 21 Jul 2008 at 10:43pm
Please consider donating $1 per sample downloaded, - find out why here .
The question is, how do you write a query which find the maximum value of a given group, but then returns all of the values associated with that record? A simple Totals query won't do it. If you try to add other fields, it will group on those as well. If you use some other function like FIRST, you will get just the first value of the other field it can find, not the value that is associated with the value returned with MAX.

The solution is to use a subquery. In a sub query, you return a list of values to the main query which you can evaluate in the WHERE clause with the IN operator.

Access 97 (11 KB): - uploads/5/
Access 2000 (18 KB): - uploads/5/

Consider donating $1 per sample downloaded," rel="nofollow - find out why here .<

Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.03 -
Copyright ©2001-2019 Web Wiz Ltd. -