0

I need to query a table that has "Units" "Date" and "Name" and get the rolling average of units per month per person when there are multiple units per day per person on individual rows.

For example:

Name            Date        Units
John Smith      1-1-2022    1
John Smith      1-1-2022    1
Jane Smith      1-1-2022    1
Jane Smith      1-1-2022    1

The Unit count is ALWAYS 1 and there are multiple days per month. PLEASE HELP

Ken White
  • 123,280
  • 14
  • 225
  • 444
  • Can you provide a more complex input table and output table you need to have, including infos about the field types? – lemon Apr 01 '22 at 20:56
  • Please provide sample data, your efforts (SQL) to solve the problem yourself, and the expected output you want from that sample data. – Ken White Apr 01 '22 at 23:24

1 Answers1

0

If you want to average you can use the AVG which returns the average value.

Example query using AVG;

Select name, MonthName(date), AVG(Unit) as average from yourtable group by monthname(date), name
fonz
  • 167
  • 8