I have got a table as follows,
ID | CreatedAt_1 | CreatedAt_2 |
---|---|---|
ABC | 2022-06-10 20:28:37 | |
CFR | 2022-06-13 10:00:12 | 2022-06-10 20:28:14 |
PFR | 2022-06-17 12:20:40 | |
XYZ | 2022-06-10 16:45:05 | |
DFL | 2022-06-13 15:00:06 | |
FGT | 2022-06-20 10:00:20 | 2022-06-10 13:34:55 |
I already used this query to count number of rows on specific date for each column
SELECT
(CAST(datetrunc(‘day’, ‘createdAt_1’ + (INTERVAL '1 day'))) AS timestamp) + (INTERVAL '-1 day')) AS ‘new user’,
count(*) AS ‘count’
FROM Table
WHERE {{time_interval}}
GROUP BY ‘new user’
And get something like :
Day | Count |
---|---|
2022-06-10 | 1 |
2022-06-13 | 2 |
2022-06-15 | 1 |
I would like to be able to compare both columns and get percentage on specific day count(createdAt_1) / count(createdAt_2) * 100 but i don’t see how to easily do it considering I’m using the count and the group by to have specific information on each day.
If anyone has any idea how two compare those two metrics.