Thursday, 29 January 2009

SQL Case statement

CASE Column1
  WHEN 1 THEN Column2*1
  WHEN 2 THEN Column2*2
  ELSE Column2
END as MyColumn,
-- or
CASE 
  WHEN max(Column1) = 1 THEN Column2*1
  WHEN max(Column1) = 2 THEN Column2*2
  ELSE Column2
END as MyColumn,

No comments:

Post a Comment