Re: group and sort by month / site
- From: Emelina Bumsquash <EmelinaBumsquash@xxxxxxxxxxxxxxxxxxxxxxxxx>
- Date: Fri, 6 Jul 2007 07:36:05 -0700
yep, a strict copy and paste! i can't get into the BDE view as it won't let
me get out of the SQL view because it keeps giving me that error message -
i'll try to start from scratch using the BDE view perhaps?
"Gary Walter" wrote:
Hi Emilina,.
That does not make sense...
the expression does not need to be
"part of an aggregate function" because
is part of the "group."
What does the column look like in BDE?
From your SQL, it should look like:
(I won't type out all of function innards)
Field: Month_Year: DateSerial(xxxx)
Table:
Total: Group By
Sort:
Show: <checked>
Criteria:
or:
What happens if you "toggle" the sigma icon
to temporarily "ungroup." Does the expression
return the correct results?
Is the SQL you provided a strict "copy-and-paste?"
It looks perfect to me...
"Emelina Bumsquash" wrote
thanks so much for your prompt response. however, i can't seem to make the
query work. i'm guessing you were shorthanding some of the code so here's
the
SQL i've got based on your help:
SELECT
DateSerial (Year(Recruitment.DateOfReferral),
Month(Recruitment.DateOfReferral), 1) AS Month_Year,Screened.Site,
Count(Recruitment.DateOfReferral) AS CountOfDateOfReferral
FROM Screened INNER JOIN Recruitment ON
Screened.StudyNumber=Recruitment.StudyNumber
GROUP BY
DateSerial(Year(Recruitment.DateOfReferral),Month(Recruitment.DateOfReferrall),
1), Screened.Site;
but i get the error message: 'you tried to execute a query that does not
include the specified expression DateSerial
(Year(Recruitment.DateOfReferral), Month(Recruitment.DateOfReferral), 1)
as
part of an aggregate function'
any help greatly appreciated as always!
"Gary Walter" wrote:
Hi Emilina,
There are so many ways...
but, if we are not talking millions of records here,
I might just recast all dates to the first of the month
using DateSerial()
SELECT
DateSerial(Year(R.DateOfReferral),
Month(R.DateOfReferral),
1) AS Month_Year,
S.Site,
Count(R.DateOfReferral) AS CountOfDateOfReferral
FROM
Screened As S
INNER JOIN
Recruitment As R
ON
S.StudyNumber = R.StudyNumber
GROUP BY
DateSerial(Year(R.DateOfReferral),
Month(R.DateOfReferral),
1),
S.Site;
I did not include ORDER BY
since your report grouping will
override it anyway where you
would group by "Month_Year"
and sort by Month_Year, Site.
The report textbox bound to "Month_Year"
could then be formatted to "mmm yy"
That might be one way...
good luck,
gary
- Follow-Ups:
- Re: group and sort by month / site
- From: Gary Walter
- Re: group and sort by month / site
- References:
- Re: group and sort by month / site
- From: Gary Walter
- Re: group and sort by month / site
- From: Emelina Bumsquash
- Re: group and sort by month / site
- From: Gary Walter
- Re: group and sort by month / site
- Prev by Date: Re: group and sort by month / site
- Next by Date: Re: group and sort by month / site
- Previous by thread: Re: group and sort by month / site
- Next by thread: Re: group and sort by month / site
- Index(es):
Relevant Pages
|