diff --git a/queries/registration_per_day.sql b/queries/registration_per_day.sql new file mode 100644 index 0000000..92a8a95 --- /dev/null +++ b/queries/registration_per_day.sql @@ -0,0 +1,6 @@ +SELECT DATE(PARSE_TIMESTAMP('%Y-%m-%d %H:%M:%S', REPLACE(JSON_EXTRACT(P.data, '$.createdAt'), '"', ""))) AS creation_dates, COUNT(DISTINCT JSON_EXTRACT(P.data, '$._id')) AS creation_count +FROM `hpos-prod.firestore_export.patientData_raw_latest` AS P +WHERE JSON_EXTRACT(P.data, '$.createdAt') <> '""' +GROUP BY creation_dates +ORDER BY creation_dates DESC +LIMIT 7 \ No newline at end of file