asked on
CREATE TABLE TARGET PCTFREE 0 NOLOGGING AS
SELECT Column1, Column2, Column3, ColumnN,
case when bitand(coh.cohorts, 2) <> 0 then 1 else 0 end pov_coh_Aa01,
case when bitand(coh.cohorts, 4) <> 0 then 1 else 0 end pov_coh_Aa02,
case when bitand(coh.cohorts, 8) <> 0 then 1 else 0 end pov_coh_Aa03,
case when bitand(coh.cohorts, 16) <> 0 then 1 else 0 end pov_coh_Aa04,
case when bitand(coh.cohorts, 32) <> 0 then 1 else 0 end pov_coh_Aa05,
case when bitand(coh.cohorts, 64) <> 0 then 1 else 0 end pov_coh_Aa06,
case when bitand(coh.cohorts, 128) <> 0 then 1 else 0 end pov_coh_Aa07,
case when bitand(coh.cohorts, 512) <> 0 then 1 else 0 end pov_coh_Aa08,
case when bitand(coh.cohorts, 1024) <> 0 then 1 else 0 end pov_coh_Aa09
FROM SomeTable
LEFT OUTER JOIN SomeOtherTable
LEFT OUTER JOIN YetAnotherTable coh
LEFT OUTER JOIN YouGetTheIdea