sql - Return column name with coalesce -
I do not want to select zero value before several columns in my table. Normally I use the SELECT COALESCE (col1, col2, col3) from the table
to
, but this time I do not need the price , But the name of the column is an example:
Table:
col1 | Col2 | Call 3 tap. Empty | 3 tap 5 | 8 2 empty | 2
should come back:
col3 col2 col1
to do this with a single SQL statement Any way?
Note: I am using PostgreSQL.
I would suggest using case
statement
Select when call 1 is not 'call1' when call is not 2 '2' when call 3 or else 'call 3' tap ends from table;
Comments
Post a Comment