Hey :elementary: team :wave: , I want to monitor ...
# community-support
i
Hey elementary team 👋 , I want to monitor the ration between record types in my table and I am not sure how to do it. I have a table where the column
record_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.
Copy code
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 ?
d
Hey @Ilya Michlin, Did you have a look on dimension_anomalies ? I think it achieves what you want. (without building the query you mentioned)