View Single Post
  #4   Report Post  
Alex H
 
Posts: n/a
Default

Thanks Ron foryour help

Using your example i have:
SELECT
FORMAT(Date Started,`YYYYMM') AS 'YrMth', Count(*) AS 'PCount'
FROM `C:\MIS\MISDATA`.tblStudents
Group by Format(tblStudents.`Date Started`,'YYYYMM')

Somethings not quite right - dont suppose you can see what it is can you?

Thanks
Alex


"Ron Coderre" wrote in message
...
As I keep forgetting, MS Query will also build the query for you if you:
Set it to return Grouped Values (ViewQuery PropertiesGroup Records).
Add a column and set it to Count (RecordsAdd Column).

The resulting SQL code will resemble this:
SELECT
FORMAT(Date_LU.RefDate,'YYYYMM') AS 'YrMth',
Count(*) AS 'Periodcount'
FROM `C:\CoderreR\Finances\Cash_Analysis_2005_db`.Date_ LU Date_LU
GROUP BY FORMAT(Date_LU.RefDate,'YYYYMM')
HAVING (FORMAT(Date_LU.RefDate,'YYYYMM') Between '200501' And '200505')

--
Regards,
Ron