Skip to content
Advertisement

How does UNION ALL return blanks in one column and data in another?

I’ve a View that has two SELECT statements returning data using UNION ALL.

So, all the columns in table1 are supposed to display data because column4=’A’. However, in table2, column2 should return blanks/null because column4=’B’. Keep in mind, column2 in table2 DOES contain data, but in the View, we only want to return blank/nulls.

Advertisement

Answer

You want something like this.? When Column4 is ‘B’ mask column2 as NULL or blanks. Using DECODE or even CASE WHEN can be used.

Multiple Values:

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