Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 Other Forums
 MS Access
 group records by year

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2001-07-27 : 10:15:11
carl writes "I want to group records by year and ignore the month and day. I know I can add an SQL
format statement at the end of the SQL statement but I don't remember what it is. Below
is the SQL statement and the listing that it creates. (Access 97).

DateClass	SumOfEstCost	CountOfEmplName	SumOfEstHours	ID
1/7/99 1 2 2164
1/7/99 1 2 534
12/21/98 $155.00 1 8 759
12/14/98 1 8 524
12/14/98 1 7 523


SELECT ClassHistory.DateClass, Sum(ClassHistory.EstCost) AS SumOfEstCost, Count(ClassHistory.EmplName) AS CountOfEmplName, Sum(ClassHistory.EstHours) AS SumOfEstHours, ClassHistory.ID
FROM ClassHistory
GROUP BY ClassHistory.DateClass, ClassHistory.ID
ORDER BY ClassHistory.DateClass DESC;"
   

- Advertisement -