group on year

S

sierralightfoot

In design view in an access query:
I have a date field. I want to group the returns based on based on the year.
Can I do this is the total row?
 
J

Jerry Whittle

SELECT Year([Date Field]) as TheYear,
Sum([Field1]) AS SumField1,
Sum([Field2]) AS SumField2
FROM YourTable
GROUP BY Year([Date Field])
ORDER BY Year([Date Field]) ;

Or in the query design view, surround the date field with:
Year([TheDateField])

Make sure that you go up to View and select Totals. Group By should be under
the date field.
 
S

sierralightfoot

Let's talk design view:
Where in design view (with the total view) am I putting
Year([TheDateField])



Jerry Whittle said:
SELECT Year([Date Field]) as TheYear,
Sum([Field1]) AS SumField1,
Sum([Field2]) AS SumField2
FROM YourTable
GROUP BY Year([Date Field])
ORDER BY Year([Date Field]) ;

Or in the query design view, surround the date field with:
Year([TheDateField])

Make sure that you go up to View and select Totals. Group By should be under
the date field.
--
Jerry Whittle, Microsoft Access MVP
Light. Strong. Cheap. Pick two. Keith Bontrager - Bicycle Builder.


sierralightfoot said:
In design view in an access query:
I have a date field. I want to group the returns based on based on the year.
Can I do this is the total row?
 
J

John W. Vinson

Let's talk design view:
Where in design view (with the total view) am I putting
Year([TheDateField])

In a vacant Field cell in the top row of the query grid.

John W. Vinson [MVP]
 
Top