K
Kevin C Niven
I am trying to use a DMin function in what should be a simple query,
and I think I just don't get it. My brain is mush at this point, and
I wonder if someone could give me some guidance.
I have a Query that is like this:
MyQuery
guy date thing
Fred 2/7/2010 ABC
Fred 7/2/2010 ABC
Barney 1/1/2011 ABC
Barney 2/3/2008 ABC
Wilma 1/4/2010 ABC
Wilma 1/4/2010 ABC
Barney 8/5/2009 XYZ
Fred 3/9/2008 XYZ
Fred 9/8/2011 XYZ
Wilma 3/2/2009 XYZ
I wish to do another query on the above query that returns this:
MyNewQuery
guy date thing
Barney 2/3/2008 ABC
Fred 3/9/2008 XYZ
Note that what has happened is that there are are two sets of "things"
in the above MyQuery. There are 6 ABCs and 4 XYZs. For each set of
things, I want to get the row with the oldest date. To belabor the
point, there could be, say, 250 sets, in which case, MyNewQuery would
return 250 lines with the oldest date in each set.
How do I write a query to do this? Thank you very much in advance for
any help.
A wrinkle is that I'm not sure what to do if there is a tie for oldest
date. I guess in that case, I'd return the alphanumerically first
"guy". Can you tell me how to do this as well?
Kevin
and I think I just don't get it. My brain is mush at this point, and
I wonder if someone could give me some guidance.
I have a Query that is like this:
MyQuery
guy date thing
Fred 2/7/2010 ABC
Fred 7/2/2010 ABC
Barney 1/1/2011 ABC
Barney 2/3/2008 ABC
Wilma 1/4/2010 ABC
Wilma 1/4/2010 ABC
Barney 8/5/2009 XYZ
Fred 3/9/2008 XYZ
Fred 9/8/2011 XYZ
Wilma 3/2/2009 XYZ
I wish to do another query on the above query that returns this:
MyNewQuery
guy date thing
Barney 2/3/2008 ABC
Fred 3/9/2008 XYZ
Note that what has happened is that there are are two sets of "things"
in the above MyQuery. There are 6 ABCs and 4 XYZs. For each set of
things, I want to get the row with the oldest date. To belabor the
point, there could be, say, 250 sets, in which case, MyNewQuery would
return 250 lines with the oldest date in each set.
How do I write a query to do this? Thank you very much in advance for
any help.
A wrinkle is that I'm not sure what to do if there is a tie for oldest
date. I guess in that case, I'd return the alphanumerically first
"guy". Can you tell me how to do this as well?
Kevin