Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Data Bases > Databases > group by proble...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 1 of 2 Topic 314 of 384
Post > Topic >>

group by problem in access

by <jim> Sep 27, 2005 at 08:04 PM

hi,

i have a table( tblUpdate) with the following fields

UpdateID, UpdateDate,  ActionID

UpdateID is the primary key
ActionID is a foreign key

i want to find the latest (by date) update of a particluar action.

and i can do this using the following:

SELECT Max(tblUpdate.UpdateDate) AS MaxOfUpdateDate, tblUpdate.ActionID
FROM tblUpdate
GROUP BY tblUpdate.ActionID;


this gives me :

"MaxOfUpdateDate","ActionID"
24/9/2005 ,24
26/8/2005 ,25
11/9/2005 ,26
26/9/2005 ,28

which is good but i also need the primary key, UpdateID

If i add updateID into the query  i get

SELECT Max(tblUpdate.UpdateDate) AS MaxOfUpdateDate, tblUpdate.UpdateID, 
tblUpdate.ActionID
FROM tblUpdate
GROUP BY tblUpdate.UpdateID, tblUpdate.ActionID;

i now get this

"MaxOfUpdateDate","ActionID","UpdateID"
24/9/2005 ,24,23
22/9/2005 ,24,24
26/8/2005 ,25,25
26/9/2004 ,25,26
11/9/2005 ,26,27
26/9/2005 ,28,28

which is no good because im getting results for all the updateids

i really just want :

"MaxOfUpdateDate","ActionID"
24/9/2005 ,24
26/8/2005 ,25
11/9/2005 ,26
26/9/2005 ,28

but with the primary key for each one.

any help would be much appreciated


thanks in advance

jim
 




 2 Posts in Topic:
group by problem in access
<jim>   2005-09-27 20:04:34 
Re: group by problem in access
Lemming <thiswillbounc  2005-10-04 18:15:34 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan13V112 Sun Jul 20 0:27:09 CDT 2008.