SQLite Forum

nested case statement not working
I took a "SQl for IBM DB2" class recently and decided to go through some exercises w/ SQLite.  I have this SQL statement that works perfectly for all rows where DEPTNO <> 'C01'.  But everyone in DEPTNO = 'C01' w/ matching JOBs gets a COMM = NULL.  Why does this not work?

update emp
	set comm = 
		case deptno
			when 'A00' then (comm * 1.1)
			when 'D11' then (comm * 1.2)
			when 'C01' then
				case job
					when 'ANALYST' then (comm * 1.3)
					when 'MANAGER' then (comm * 1.4)
					else null
			else comm
where comm is not null
  and deptno <> 'E21'