Query JSON from SQL group by date (not time)

Howdy :wave:

Can anyone help me with this SQL problem? I am querying JSON from SQL and I'm trying to extract just the date from a column that also has a time part. I've gone through the documents and tried date_trunc and date_format - does anyone know a simple way to just get the date and a count for the dat? Right now it's grouping by date and timestamp which isn't ideal

Might depend what Date format the underlying data is in and if it's a Date object or a string but you could try the date functions like:

group by firstMessageDate->getUTCFullYear()

or

firstMessageDate->toLocaleDateString()

Failing that the moment.js library that's bundled into Retool could probably help
https://momentjs.com/docs/

One more thought that firstMessageDate->substr(0, 10) might also work! Also want to link the docs to AlaSQL's access operator which is being referenced here :slightly_smiling_face: