在mysql中,为什么报错? select sum(contract_split_amount) as money from contract_split cs where contract_info_id=65 and contract_amount_id in
(select id from contract_amount_type where id >=4 and id <=9) and cs.money > 0 ------解决方案-------------------- 报什么错误? ------解决方案-------------------- 你这是T-SQL写法在mysql、
报错? ------解决方案-------------------- 我估计是你的 SUM(contract_split_amount) AS ‘money’的问题 MONEY是关键词 需要加引号 你加上试试。 ------解决方案--------------------
试试这个:
SELECT
money
FROM
(SELECT
SUM(contract_split_amount) AS money
FROM
contract_split cs
WHERE
contract_info_id=65 AND contract_amount_id IN (SELECT
id
FROM
contract_amount_type
WHERE
id>=4 AND id<=9)) AS t
WHERE
money>0