Quantcast
Channel: dBforums – Everything on Databases, Design, Developers and Administrators
Viewing all articles
Browse latest Browse all 13329

In Select with case Getting the actual column Name

$
0
0
I have a table with three columns.

I am selecting one column from it on some condition using case.
i.e select case when col1 is not NULL then col1
when col2 is not Null then col2
else col3
end
from table_name;

Now i want to know which column is selected. The above query will give the column heading as case or if I give any alias then the column heading will be alias name where their is no way to differentiate or to know which column is selected.

Or their is any way to get the original column name which is selected.

Please guide me..

Viewing all articles
Browse latest Browse all 13329

Trending Articles