Skip to main content
shakilahd875
May 27, 2023
Question

Aggregation on condition

  • May 27, 2023
  • 2 replies
  • 0 views

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
    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
    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.