读书人

sql2000的case转if的有关问题

发布时间: 2012-02-08 19:52:21 作者: rapoo

sql2000的case转if的问题
select
c.kp_branch_no as 仓库编号,
d.kp_branch_name as 仓库名称,
c.kp_item_no as 条码,
e.kp_item_name as 名称,
case c.kp_sell_way
when 'B ' then -c.kp_sale_qnty
else c.kp_sale_qnty end as 销售数量,
case c.kp_sell_way when 'B ' then -c.kp_sale_money
else c.kp_sale_money end as 销售金额,
b.vipID AS 会员卡号,
b.vipName as 会员名称,
b.sex as 性别,
c.kp_oper_date as 日期
from pos_jyfk_flow a , vip_info b, pos_xsflow c, jb_jgck d, jb_spzl e

中间的case语句怎么转成 if 的语句

case c.kp_sell_way
when 'B ' then -c.kp_sale_qnty
else c.kp_sale_qnty end as 销售数量,
case c.kp_sell_way when 'B ' then -c.kp_sale_money
else c.kp_sale_money end as 销售金额,
??????????

[解决办法]
用case不就可以?

什要用if?

改不了if的.
[解决办法]
在SQL SERVER好象IF不行
[解决办法]
if 不能用在SELECT 语句中
[解决办法]
应该是已往不了的
[解决办法]
倒的,又是一都不的。

主,你是不是不知道怎?
[解决办法]
case when 就相於if
[解决办法]
if 不能用在SELECT 语句中

读书人网 >SQL Server

热点推荐