Question : Coldfusion SQL how can i get the last bit field type with value 1 in the current row

Coldfusion SQL how can i get the last bit field type with value 1 in the current row

Answer : Coldfusion SQL how can i get the last bit field type with value 1 in the current row


If you need it for every row, then build it into your query.  I would use HainKurt's approach of the case statement.   Here it is modified to your columns.  The value of LastCheck column is the name of the 'last' column that has a 1 as a value...

select ID
 ,case
  when Dec=1 then 'Dec'
  when Nov=1 then 'Nov'
  ...
  when Jan=1 then 'Jan'
end as LastCheck
from myTable




Random Solutions  
 
programming4us programming4us