您的位置:首页 > 数据库

sql判断语句

2014-04-09 18:22 267 查看
方法一:

<if test="null != orderType and 0 == orderType">

order by amountTimes desc

</if>

<if test="null != orderType and 1 == orderType">

order by amountTimes asc

</if>

<if test="null != orderType and 2 == orderType">

order by amountUsedTime desc

</if>

<if test="null != orderType and 3 == orderType">

order by amountUsedTime asc

</if>

<if test="null != orderType and 4 == orderType">

order by amountUsedTime/amountTimes desc

</if>

<if test="null != orderType and 5 == orderType">

order by amountUsedTime/amountTimes asc

</if>

方法二:

case

when timage.original_url is null then '/images/no_picture.gif'

when timage.original_url is null then '/images/no_picture.gif'

when timage.original_url is null then '/images/no_picture.gif'

else timage.original_url

end as tourgallery
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: