SELECT CASE ABC.A WHEN'否' THEN'1' WHEN'是' THEN'-1' END AS 出入标识,ABC.B AS 数量,这两个字段相乘?

问题描述:

SELECT CASE ABC.A WHEN'否' THEN'1' WHEN'是' THEN'-1' END AS 出入标识,ABC.B AS 数量,这两个字段相乘?
SELECT CASE ABC.A WHEN'否' THEN'1' WHEN'是' THEN'-1' END AS 出入标识,ABC.B AS 数量,我想让这个两个相乘,即出入标识*数量,我这样做的(CASE ABC.A WHEN'否' THEN'1' WHEN'是' THEN'-1' END*ABC.B) AS 新数量,这样做语句是错误的,不知如何能让这两列相乘?

CASE WHEN 语法不对吧
CASE WHEN ABC.A = '否'THEN '1'
WHEN ABC.A = '是'THEN '-1'
END AS 出入标识
两列相乘的话, 那么 THEN 里面, 就写 1, 别写'1' 了.
然后外面再套一个查询
也就是
SELECT
出入标识 * 数量
FROM
(
SELECT . 你原有的SQL
)