-- Query type: groupSeeds
-- Query type: factsSelect
/*{"v":"4.54.7","c":171,"u":5958,"asid":"1160000","cpid":"1281","qid":"4de1dfa5-d0c4-4127-f335-ecfab207aa63","ty":"§§§facts","bqc":"1"}*/
SELECT CASE
        WHEN v.`SUB_ID` IN (26037) THEN '$1'
        ELSE 'REST'
    END AS `535dd8f5-0c1f-4577-44e4-9d26012bc0ee`,
    CASE
        WHEN v.`SUB_ID` IN (26037) THEN '$1'
        ELSE 'REST'
    END AS `abfa5864-a7a0-462f-4d70-2c5abc3801c5`,
    v.`ATC4PH_ID` AS `11600_ATC4PH`,
    v.`HSTOPH_ID` AS `11600_HSTOPH`,
    v.`PZN_ID` AS `11600_PZN`,
    COALESCE(g0.`eg_id`, 'REST') AS `9f7dbeb2-19c5-4a61-bda3-7dfc8c9e78ef`,
    COALESCE(g1.`eg_id`, 'REST') AS `67b073ab-c99e-4848-9532-3a5239643a8c`,
    COALESCE(g2.`eg_id`, 'REST') AS `f1c0b686-903f-4f6f-ff4c-c0bc3919588f`,
    SUM(`VAL_25_430`) AS `VALUE_2025_01_M_430_1_1`,
    SUM(`VAL_25_5432`) AS `VALUE_2025_01_M_5432_1_2`,
    SUM(`VAL_25_5430`) AS `VALUE_2025_01_M_5430_1_3`
FROM `DE_ODVCAN_11600_202501`.`V_FACT_DE_ODVCAN_11600` AS v
    JOIN `DE_ODVCAN_11600_202501`.`group_f38275cd_db16_4e71_9306_c20af09d4c8b` AS g0 ON g0.`key_id` = v.`REGODV_ID`
    JOIN `DE_ODVCAN_11600_202501`.`group_6b1d15de_368d_4239_a5df_09a2ca386b97` AS g1 ON g1.`key_id` = v.`REGODV_ID`
    JOIN `DE_ODVCAN_11600_202501`.`group_7d5e323d_69ab_413e_817b_2fde051ec00c` AS g2 ON g2.`key_id` = v.`REGODV_ID` -- WHERE 1 = 1
    --     AND v.`WERTART_ID` IN (1)
    --     AND v.`NFC3_ID` IN (178)
    --     AND v.`SUB_ID` IN (26037)
    --     AND v.`SUB_ID` IN (26037)
    --     AND v.`HSTOPH_ID` IN (9873, 12770, 929, 4665)
GROUP BY `535dd8f5-0c1f-4577-44e4-9d26012bc0ee`,
    `abfa5864-a7a0-462f-4d70-2c5abc3801c5`,
    `11600_ATC4PH` --     `11600_HSTOPH`,
    --     `11600_PZN`,
    --    `9f7dbeb2-19c5-4a61-bda3-7dfc8c9e78ef`,
    --    `67b073ab-c99e-4848-9532-3a5239643a8c`,
    -- `f1c0b686-903f-4f6f-ff4c-c0bc3919588f`
LIMIT 1000000;
-- maxscale route to master
-- Query type: groupDrops