SELECT 
   EPI_PK, 
   EPI_AVAILABILITY, 
   CASE WHEN (FLOOR(EPI_AVAILABILITY/8)%4) = 1 THEN 1 ELSE 0 END AS VF, 
   CASE WHEN (FLOOR(EPI_AVAILABILITY/4)%4) = 1 THEN 1 ELSE 0 END AS VO, 
   CASE WHEN (FLOOR(EPI_AVAILABILITY/16)%4) = 1 THEN 1 ELSE 0 END AS VM, 
   CASE WHEN (FLOOR(EPI_AVAILABILITY/2)%4) = 1 THEN 1 ELSE 0 END AS ST, 
   CASE WHEN (EPI_AVAILABILITY%2) = 1 THEN 1 ELSE 0 END AS VOST 
FROM `episode`
WHERE EPI_AVAILABILITY >0