select mechdate, sum(settleAmount), sum(mechSeqId), sum(orderamount), sum(settleFee), sum(ROUND(rateAmount,2))
from (select substring(mechdate,1,6) as mechdate,
count(mechSeqId) as mechSeqId,
sum(orderamount) as orderamount,
sum(ORDERAMOUNT - CENTERFEE) as settleAmount,
sum(ORDERAMOUNT - (ORDERAMOUNT - CENTERFEE)) as settleFee,
sum(ORDERAMOUNT*0.0005) as rateAmount
from boc_payinfo
where PROCSTATE = '04' and ACCCHECKSTATE = '02' and mechno = "+mechNo + whereStr+"
group by mechdate) group by mechdate order by mechdate
[Err] 1248 - Every derived table must have its own alias
from 後面不就是一個大的子查詢嗎。。
報錯信息 查一下是說派生的表必須有別名 group by mechdate) group by mechdate order by mechdate
在這裡給你子查詢出來的表 取個名字呗