How to count number of dates base on usage

that’s not a numbers table

this is what you need –

CREATE TABLE numbers ( n INTEGER NOT NULL PRIMARY KEY ) ; INSERT INTO numbers VALUES ( 0),( 1),( 2),( 3),( 4),( 5),( 6),( 7),( 8),( 9) ,(10),(11),(12),(13),(14),(15),(16),(17),(18),(19) ,(20),(21),(22),(23),(24),(25),(26),(27),(28),(29) ,(30) ;
let me know when you’ve got this ready

you can load it with more integers, but you’ll need at least 31 numbers to select a month’s worth of dates