Skip to content
Advertisement

How to group by two columns in different CASE clauses

I have a query that’s giving me the results I want, but for each item with a given ID_UNIDAD_EXPERIMENTAL there are two rows, one with column “Alt” with a value and column “Dap” with null, and the other one with “Alt” null and “Dap” with a value. My question is: How can I group them so each element with a given ID just shows both Alt and Dap columns with values, kind of “removing” the nulls.

Heres the query:

and here are the results:

query results

you can see that there are two rows for each “id_unidad_experimental” and each row has one column with a null value, the goal is to only show one row for “id_unidad_experimental” with the two values.

Any help would be nice

Advertisement

Answer

Try it like:

User contributions licensed under: CC BY-SA
6 People found this is helpful
Advertisement