A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Running & Setting Up Queries
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Group By, Max & Last



 
 
Thread Tools Display Modes
  #1  
Old February 22nd, 2010, 11:17 AM posted to microsoft.public.access.queries
Statsman
external usenet poster
 
Posts: 2
Default Group By, Max & Last

I've got a table that has:

ID Postsector Effective Date Contents Area Buildings Area
1 AB1 1 01/01/10 10 6
2 AB1 1 01/04/10 8 10
3 NR2 2 01/01/10 12 13
4 NR2 2 01/04/10 8 8

etc, etc.

I want the latest Contents & Building Areas for each postsector.
i.e. Postsector Effective Date Contents Area Buildings Area
AB1 1 01/04/10 8 10
NR2 2 01/04/10 8 8

I tried a query that did Group By on Postsector & Max on Effective
Date.
I'm then forced to choose something for the Contents Area & the
Buildings Area.
But if I choose Last I don't get the last entry in the table but the
highest number.

Please can someone advise what the query should look like?

Thanks in advance.
  #2  
Old February 22nd, 2010, 01:27 PM posted to microsoft.public.access.queries
vanderghast
external usenet poster
 
Posts: 593
Default Group By, Max & Last

Try one of the methods presented at
http://www.mvps.org/access/queries/qry0020.htm


Vanderghast, Access MVP


"Statsman" wrote in message
...
I've got a table that has:

ID Postsector Effective Date Contents Area Buildings Area
1 AB1 1 01/01/10 10 6
2 AB1 1 01/04/10 8 10
3 NR2 2 01/01/10 12 13
4 NR2 2 01/04/10 8 8

etc, etc.

I want the latest Contents & Building Areas for each postsector.
i.e. Postsector Effective Date Contents Area Buildings Area
AB1 1 01/04/10 8 10
NR2 2 01/04/10 8 8

I tried a query that did Group By on Postsector & Max on Effective
Date.
I'm then forced to choose something for the Contents Area & the
Buildings Area.
But if I choose Last I don't get the last entry in the table but the
highest number.

Please can someone advise what the query should look like?

Thanks in advance.


  #3  
Old February 22nd, 2010, 02:00 PM posted to microsoft.public.access.queries
Statsman
external usenet poster
 
Posts: 2
Default Group By, Max & Last

On Feb 22, 1:27*pm, "vanderghast" vanderghast@com wrote:
Try one of the methods presented athttp://www.mvps.org/access/queries/qry0020.htm

Vanderghast, Access MVP

"Statsman" wrote in message

...



I've got a table that has:


ID * Postsector * Effective Date * Contents Area * Buildings Area
1 * * *AB1 1 * * * * *01/01/10 * * * * * *10 * * * * * * * * * *6
2 * * *AB1 1 * * * * *01/04/10 * * * * * *8 * * * * * * * * * * *10
3 * * *NR2 2 * * * * *01/01/10 * * * * * *12 * * * * * * * * * * 13
4 * * *NR2 2 * * * * *01/04/10 * * * * * * 8 * * * * * * * * * * *8


etc, etc.


I want the latest Contents & Building Areas for each postsector.
i.e. Postsector * Effective Date * Contents Area * Buildings Area
* * * *AB1 1 * * * *01/04/10 * * * * * * 8 * * * * * * * * * * * 10
* * * *NR2 2 * * * *01/04/10 * * * * * * 8 * * * * * * * * * * * *8


I tried a query that did Group By on Postsector & Max on Effective
Date.
I'm then forced to choose something for the Contents Area & the
Buildings Area.
But if I choose Last I don't get the last entry in the table but the
highest number.


Please can someone advise what the query should look like?


Thanks in advance.- Hide quoted text -


- Show quoted text -


Many thanks, that works fine.
 




Thread Tools
Display Modes

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

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 03:55 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.