I have an ACTIVITY table with Date, Zip, Category (from lookup table CAT) and Sub-Category (from lookup table SUBCAT).
I have successfully created a Pivot-Table query that shows activity counts by Zip for each Category and Sub-Category within a date range.
The SQL for the above is:
SELECT Activity.Zip, Count(Activity.Zip) AS CountOfZip, Activity.Cat, Activity.SubCat
FROM Activity
WHERE (((Activity.Date) Between [Enter Beginning Date] And [Enter Ending Date]))
GROUP BY Activity.Zip, Activity.Cat, Activity.SubCat;
I need to create a similar Pivot-Table query that shows the TOP 3 most active Zips (the highest counts) within a date range.
Might someone please assist with a code sample to accomplish this?
Thanks in advance,
-bill
I have successfully created a Pivot-Table query that shows activity counts by Zip for each Category and Sub-Category within a date range.
The SQL for the above is:
SELECT Activity.Zip, Count(Activity.Zip) AS CountOfZip, Activity.Cat, Activity.SubCat
FROM Activity
WHERE (((Activity.Date) Between [Enter Beginning Date] And [Enter Ending Date]))
GROUP BY Activity.Zip, Activity.Cat, Activity.SubCat;
I need to create a similar Pivot-Table query that shows the TOP 3 most active Zips (the highest counts) within a date range.
Might someone please assist with a code sample to accomplish this?
Thanks in advance,
-bill