SHARE
TWEET

POSTGRES IF statement fails

a guest Feb 21st, 2012 6 Never
  1. ERROR:  syntax error at or near "status" at character 11
  2. LINE 1: SELECT IF status = 'L' THEN edate ELSEIF status = 'C' THEN '...
  3.        
  4. SELECT
  5.   CASE status
  6.     WHEN 'L' THEN edate
  7.     WHEN 'C' THEN 'wrong date'
  8.   END as date
  9. FROM
  10.   campaigns;
RAW Paste Data
Top