I have four columns and one row in a table; I want use a SQL query to return a number (0-4) that identifies the first column (left to right) that is null or empty.
For example if columns 1, 2 and 3 contain data, the query would return “4”.
If columns 1 and 4 contain data, the query would return “2”.
If none of the columns contain data, the result should be “1”.
If they all contain data, then “0”
Is there a logical solution for all 16 combinations that wouldn’t require explicitly testing each possibility?
I have four columns and one row in a table; I want use a
Share
1 Answer