可以的吧,出NULL是不是因为你字段的内容就是NULL啊。
这里是一个测试,可以看到使用列名value来做then的值是可以的:
mysql> select * from aaa;
+------+-------+
| id | value |
+------+-------+
| 1 | 1 |
| 2 | 3 |
| 3 | 4 |
| 4 | 4 |
| 5 | 4 |
| 6 | 6 |
| 8 | 8 |
| 7 | 7 |
| 9 | 8 |
| 10 | 10 |
| 11 | 11 |
| 12 | 11 |
| 13 | 11 |
| 14 | 11 |
| 15 | 12 |
+------+-------+
15 rows in set (0.00 sec)
mysql> select id, value, case id when 1 then value when 2 then 2 * value when 3
then 'xxx' else 0 end as case_col
-> from aaa;
+------+-------+----------+
| id | value | case_col |
+------+-------+----------+
| 1 | 1 | 1 |
| 2 | 3 | 6 |
| 3 | 4 | xxx |
| 4 | 4 | 0 |
| 5 | 4 | 0 |
| 6 | 6 | 0 |
| 8 | 8 | 0 |
| 7 | 7 | 0 |
| 9 | 8 | 0 |
| 10 | 10 | 0 |
| 11 | 11 | 0 |
| 12 | 11 | 0 |
| 13 | 11 | 0 |
| 14 | 11 | 0 |
| 15 | 12 | 0 |
+------+-------+----------+
15 rows in set (0.00 sec)