我有 MYSQL 查询,它工作正常查询是:
SELECT * , IF(totexec >= totexecrun1, totexec-totexecrun1,0) AS rewrk,
SUM(tcu) tcunit ,
IF(totexec=0, ((SUM(tcu)/totexec)*100),0) AS proflevel
FROM mntest_schedule a
LEFT JOIN mnrelease_details b
ON b.tester=a.tester
AND a.project=b.project
LEFT JOIN tc_details c
ON b.tc_id=c.tc_name
AND a.project=c.project
WHERE a.rel_name='automanual_assign'
AND a.project='JupiterQA'
GROUP BY a.tester;
我试图在 MSSQL 中执行相同的查询,但它抛出错误。错误是:
Msg 156, Level 15, State 1, Line 1
Incorrect syntax near the keyword 'IF'.
Msg 102, Level 15, State 1, Line 1
Incorrect syntax near ','.
Msg 102, Level 15, State 1, Line 1
Incorrect syntax near ','.
我对这个查询做错了吗?