SELECT
DJLXBM,
CASE WHEN DJLXBM='D3' THEN YBJE ELSE 0 end as 采购付款金额 ,
CASE WHEN [DJLXBM]='D3' THEN [YBJE] ELSE 0 end as '采购付款金额' , -- 字段不能 加 [] 中括号 ,别名 不能 加 '' 单引号
case when DJLXBM='D3' then DJRQ else null end as 采购付款时间,
case when DJLXBM='D2' THEN YBJE else 0 end AS 销售收款金额,
case when DJLXBM='D2' then DJRQ else null end 销售收款时间
FROM
ARAP_DJZB
本文摘自 :https://www.cnblogs.com/