Skip to main content
shakilahd875
Participating Frequently
May 27, 2023
Question

Aggregation on condition

How to apply Aggregation (grouping) based on condition as like Group by on condition in Mysql?

Example: SELECT * FROM `TABLE` GROUP BY ( CASE WHEN `NAME` = 'AA' THEN `COLUMN1` ELSE `COLUMN2` END );

    2 replies

    stefanhelzle0001
    Brainy
    May 27, 2023

    That's not supported directly. Depending on what you are looking for, synced records and custom record fields might be a solution.

    harshitb6843
    Brainy
    May 27, 2023

    You will need to create two different queries with the different filters as name=aa and otherwise. Or you can go with what Stefan said.