Skip to content

Tag: oracle

SQL – Adding columns

I am new to SQL and was wondering if someone can help me with this small request. I am trying to have my output like down below: But I am currently getting this output: Here is my SQL code: How can I get the columns to reflect MF, CH_A, CH_B, and CH_C with its respective value? Answer @Med2020 Your query

Separate columns by commas ignoring nulls

I have the below table: A B C D E A1 null C1 null E1 A2 B2 C2 null null null null C3 null E3 I would like the below output (separated by commas, if any value is null, then do not add a comma): F A1, C1, E1 A2, B2, C2 C3, E3 Answer You can concatenate all columns

Optimize Merge query inside n^2 loop

I’ve got a merge query that needs to be executed one time for each combination of day and sessionType inside the request ArrayList. I am using nativeQuery to execute it. Is there a way to plain the source data (two ArrayLists, one with a date range instead a single day, and the other with all the sessio…