我正在尝试求和,但如果要在其中求和,
我尝试了case
,它在我的管理员localhost php中工作,但是在服务器节点mariadb上运行时却无法工作
所以我正在尝试else if
语句,但语法却出错了
SELECT
SUM(
IF(i.currencyID = ${defCurrency} , invD.unitPrice * invD.quantity, 0)
ELSE(invD.unitPrice * invD.quantity *
(
SELECT rate
FROM currencyRate
WHERE defaultCurrencyID = ${defCurrency}
AND currencyID = i.currencyID
) as purchasePrice,
FROM Invoice i, invoiceDetails invD, materialUnit mu
WHERE mu.materialUnitID = invD.materialUnitID
GROUP BY mu.materialUnitID