month of date

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have a table which containes ddate, and number. I need a query to get only
the numbers for a month depending on the max date in the table. Example

if tabel containes, the query should show

ddate number 11/1 1300 only
9/1 1200
10/1 1000
10/12 2000
11/1 1300

If I check for month(ddate) = month(max(ddate)), I am getting an aggregate
not allowed error. Any ideas?

Thanks
 
I have a table which containes ddate, and number. I need a query to get only
the numbers for a month depending on the max date in the table. Example

if tabel containes, the query should show

ddate number 11/1 1300 only
9/1 1200
10/1 1000
10/12 2000
11/1 1300

If I check for month(ddate) = month(max(ddate)), I am getting an aggregate
not allowed error. Any ideas?

Thanks

As long as you are unconcerned about having more than one years worth
of data:

SELECT YourTable.ADate, YourTable.ANumber
FROM YourTable
Where Month( YourTable.ADate) =Month( DMax("[ADate]","YourTable"));

If you do wish to restrict data to the month and YEAR of the maximum
date entry of and have more than one years worth of data, use:

Where Format(YourTable.ADate,"mmm yyyy") = Format(
DMax("[ADate]","YourTable"),"mmm yyyy");
 
Back
Top