Trying to understand Group By
- From: syvman@xxxxxxxxx
- Date: 21 Jun 2006 16:26:21 -0700
Hi all... I have a quick question, if anyone knows the answer. I've
built a query which looks at a set of records in a table (tblFilename)
and I've set it up so that it displays the following fields:
filename, filedate, origin
Let me first explain the data - filename contains filenames, of which
there could be multiple items... filedate is the respective date stamp
from the filename listed... origin is the folder name where the file
is located.
My query takes the max of filedate, which (to my understanding) would
eliminate all of the other records that have multiple filedate records
(it would only keep the newest one), leaving me with a list of unique
filenames. This works - as long as I am only trying to get two fields
- filename and filedate. As soon as I add "origin" as another field
(it throws a "Group By" in the Total: section), I get all the records
in the table. It no longer tosses out the older dates. So my question
is - why does this happen? Shouldn't I be able to get the related
'origin' field information of the records that I'm keeping? Is it the
"Group By" that is causing my grief? Keep in mind that I'm staying
within the query builder - my SQL skills aren't too strong. However, I
HAVE tried adding DISTINCT to the select statement, but it doesn't
reduce the resulting records that my query produces.
Maybe I'm not explaining myself very well - I'm not entirely sure. If
anyone has an idea, could you please set me straight? Thanks!
-Terry
.
- Follow-Ups:
- Re: Trying to understand Group By
- From: Rick Brandt
- Re: Trying to understand Group By
- From: Rick Brandt
- Re: Trying to understand Group By
- Prev by Date: Re: "I want MyMDB" (apologies to Mark Knopfler)
- Next by Date: Re: Trying to understand Group By
- Previous by thread: run simple SQL code from within a query
- Next by thread: Re: Trying to understand Group By
- Index(es):
Relevant Pages
|
Loading