Maybe someone can help me with this SQL problem. The user app is Excel, data in back end Access table. To simplify, I have a table "T1" with a date field, a category field, and a count field. Sample might look like this...
Date Cat Ct
4/2/19 Blue 5
4/2/19 Black 8
4/2/19 Green 3
4/2/19 Red 10
4/3/19 Black 9
4/3/19 White 5
...and so on with several of the same date. The question is what SQL statement is needed to pull the top 2 categories (highest count) from each date within a date range. Dates in the table span 1/1/2018 to 12/31/19 and any range within could be selected by the user. The output might look like this....
Date Cat Ct
4/2/19 Red 10
4/2/19 Black 8
4/3/19 Black 9
4/3/19 etc
4/4/19 etc
4/4/19 etc
etc
I'm relatively new to SQL but I've seen a reference to "partition", but I'm not sure that works with Excel/Access, and I haven't found an equivalent (in my brief search for the solution).
Nevertheless, your help would be great.
Lewis
Bookmarks