How to merge rows in a grid?

How everyone,

I have the requirement to merge two or more rown in a grid. An example is shown below:

Col A Col B Col C
1 2 ab
cd
7 9 yz

If the value of col A and col B are same for two rows and Col C value is different then both rows for col A and Col B should be merged.

Thank You

  Discussion posts and replies are publicly visible

Parents
  • Assuming this data is sourced from a database table, the simplest way you can achieve this is by creating a view to merge data across multiple rows using group by clause For e.g. the view query for oracle would be like (here ID is the primary key of the table, you can use any existing columns to order by in this case) -

    select COLA, COLB,  listagg(COLC,',')  within group( order by ID ) MERGED_COLUMN
      from ORACLE_TEST4 group by COLA, COLB;
    

    For MySQL DB you can use GROUP_CONCAT().

    Once this view is created you can simply source your grid based off this view.

Reply
  • Assuming this data is sourced from a database table, the simplest way you can achieve this is by creating a view to merge data across multiple rows using group by clause For e.g. the view query for oracle would be like (here ID is the primary key of the table, you can use any existing columns to order by in this case) -

    select COLA, COLB,  listagg(COLC,',')  within group( order by ID ) MERGED_COLUMN
      from ORACLE_TEST4 group by COLA, COLB;
    

    For MySQL DB you can use GROUP_CONCAT().

    Once this view is created you can simply source your grid based off this view.

Children
No Data