Ilya Michlin
02/01/2024, 7:29 AMrecord_type can have 2 values (t1 and t2). I want to monitor the ratio between the number of t1 records to the number of t2 records every day.
WITH counts AS (
SELECT
SUM(CASE WHEN record_type = 't1' THEN 1 ELSE 0 END) AS t1_count,
SUM(CASE WHEN record_type = 't2' THEN 1 ELSE 0 END) AS t2_count
FROM MY_SCHEMA.MY_TABLE
)
SELECT t1_count / t2_count AS division_result FROM counts
What would be the best way to achieve this in elementary ?Daniel Pollak
02/01/2024, 9:54 AM