mysql-case ... when...then...else...end处理判断赋值机制

select stockcode,stockname,(zxj-(case zrspj when 0 then jrkp else zrspj end ))/(case zrspj 
when 0 then jrkp else zrspj end ) zdf
from hqxg
where stockcode like '_3%' and zxj-(case zrspj when 0 then jrkp else zrspj end )<0
order by zdf
LIMIT 0,3;

 

posted @ 2016-01-04 15:41  243573295  阅读(708)  评论(0编辑  收藏  举报