各位高手来帮我看看sql的问题吧,谢谢啦,在线等答案啊

zero0412 09-07-10

mySql数据库
我想把查询结果中值为null的数据赋值为null.jsp
语句如下:
select distinct i.productId,i.colorId,i.isDeleted,i.isShelves,case c.colorImg when "" then "xxx.jpg" when c.colorImg is null then "null.jpg" when c.colorImg then c.colorImg end as colorImg from t_productitem i left outer join t_productcolor c on (i.colorid=c.colorid) where colorImg is null
可是查出来的该是null的还是null,我就郁闷了咧.
各位高手帮帮忙哈,谢谢了先.
不行的话还有建表语句.
[该贴被zero0412于2009-07-10 10:37修改过]

jvcoffee
2009-07-10 11:18

select distinct i.productId,i.colorId,i.isDeleted,i.isShelves,case c.colorImg is null when '1' then 'xxx.jpg' else '' end from t_productitem i left outer join t_productcolor c on (i.colorid=c.colorid) where colorImg is null

mysql参考手册上有对null的详细解释



[该贴被jvcoffee于2009-07-10 11:31修改过]

zero0412
2009-07-10 11:38

果然是高手,牛B得没话说,thank you vary much!