SELECT SUM(XSJE / 1000) AS XSJE, SUM(SL) AS SL, LRRQ
FROM MTGL_C_KPXX
WHERE (LRRQ BETWEEN ? AND ?)
sql語句於上,我想統計每天的銷售金額總量和總數量,每天有多個銷售金額,每個銷售金額有一個時間,要統計一天的總和,group by 達不到我要的效果,然後就報錯,不知道怎麼改
SELECT SUM(XSJE / 1000) AS XSJE, SUM(SL) AS SL, DATA_FORMAT(LRRQ,'%Y-%m-%d') as dt
FROM MTGL_C_KPXX
WHERE (LRRQ BETWEEN ? AND ?) group by dt