Nested case statement in sql. So its gonna display value 1 or 0.

Nested case statement in sql. Any help will be greatly appreciated.