select case problem

From: Joseph Syjuco <joseph(at)asti(dot)dost(dot)gov(dot)ph>
To: pgsql-sql(at)postgresql(dot)org
Subject: select case problem
Date: 2002-09-24 21:45:34
Message-ID: 1032903934.28249.2.camel@Falcon
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

i have a table with the fields empno (not null) and division_no (null
allowed) what i wanted to do is to do a select case statement such that
when division_no is null itll output 'No division' if its not null itll
output 'with division' unfortunately this statement doesnt work ... i
need help on the correct syntax

select case division_no when null then 'no division' else 'with
division' end from employee;

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Roland Roberts 2002-09-24 21:48:21 Re: [SQL] CURRENT_TIMESTAMP
Previous Message CoL 2002-09-24 16:18:55 Re: lastoid from sql