Help improving my query

If feel like this is far from how what it actually should look like in drizzle could I get some pointers what I can improve
1 Reply
bloberenober16mo ago
1. You can reference columns inside sql 2. You can put a whole subquery inside sql (for total_count) 3. You can use a callback inside .groupBy and .orderBy to reference the selected column, but for that you'll need to use .as('date')