Omit null value columns while executing select query on a table

65 Views Asked by At

I have a table that has 700 columns. I need to execute a query based on a condition but I dont want to browse through 700 columns and look for data. I want to eliminate columns that has null values only.

For eg: select * from table1 where message in ('value1', 'value2')

The result of this statement has 700+ columns.

Table:

Column A Column B ...Column ZA
Value1 Null ...Value1
Value2 Null ...Value2

While displaying the select statement results I want to omit Column B since it only has nulls.

So far I'm using python to filter the output file not able to do it in sql statement. I want to omit the null columns from the result of select statement.

0

There are 0 best solutions below