嗨,我需要弄清楚为什么我的代码的最后一部分将无法运行。
任何帮助都会很棒。
SELECT
xxxx,
xxxx,
xxxxy,
COUNT(xxxx) * xxxx AS Driver_fees,
COUNT(xxxx) * xxxx AS Revenue,
-- 'This section will not run'
SUM((COUNT((xxxx) * xxxx)) -
(COUNT((xxxx) * xxxx))) AS Gross_Profit
FROM
xxxx INNER JOIN xxxx ON xxxx` = xxxx
WHERE week = 11 AND day ='Sunday'
GROUP BY week, date
答案 0 :(得分:0)
假设Gross_Profit = Revenue - Driver_fees
,您实际上并不想在此查询中使用SUM
COUNT(xxxx) * yyyy AS Driver_fees,
COUNT(wwww) * zzzz AS Revenue,
COUNT(wwww) * zzzz - COUNT(xxxx) * yyyy AS Gross_Profit