It seems simple, but I could not find anything. Any help is appreciated.
I have a table with multiple columns. I need to compare several of these columns with each other and remove the rows in which they correspond to each other, or NULL. In other words, I need to leave lines only where there are differences other than NULL. (If it matters, I will run it several times against tables with a different number of compared columns, sometimes a lot of columns, so all queries that focus on only three columns will not work.)
So if my table is:
ID TITLE VALUE_1 VALUE_2 VALUE_3
1 One AAA NULL NULL
2 Two NULL AAA AAA
3 Three AAA AAA AAA
4 Four NULL NULL NULL
5 Five AAA BBB CCC
6 Six AAA BBB NULL
7 Seven NULL DDD EEE
8 Eight AAA AAA BBB
After completing the request, I want to have
ID TITLE VALUE_1 VALUE_2 VALUE_3
5 Five AAA BBB CCC
6 Six AAA BBB NULL
7 Seven NULL DDD EEE
8 Eight AAA AAA BBB
Thanks again for your time.
source
share