Question Locked

Establish a Grouping of Data in Access

0 helpful
2 replies
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.

I have a set of products that are published annually where i need to track the currency of the products as a statistic. (ex. 10% are 1-2 years old, 20% are 2-3 years old, etc.)

The database stores the date of publication. How can I use a query to assign products with post date between x and y to the 1 year category, and products with post date between z and f to the 2-3 year category, etc.

I need to establish a pivot table that groups products by the office that produced them, and the age of the products grouped by age.

I'm at a complete lost, I respectfully request help.

2 replies

by tony hopkinson

Years old from the time you are running the query would be

Select DateDiff('y',Now()) as YearsOld,[PubDate]), Count(*) as NumberOfProducts From Products
Group By DateDiff('y',Now())

would give

1 20
2 18
3 20

Assuming everything is over a year old !

HtHs

This discussion is closed to new replies.