我有一个数据库,其中包含我的在线网上商店的所有交易,我试图进行查询以打印出一份简单的财务报表。
它将打印在这样的表格中:
<th>month</th>
<th>number of sales</th>
<th>money in</th>
<th>money out</th>
<th>result</th>
查询失败:#1111 - 组函数的使用无效
SELECT
month(transaction_date) as month,
count(incoming_amount > '0') as number_of_sales,
sum(incoming_amount / 1.25) as money_in,
sum(outgoing_amount) as money_out,
sum((incoming_amount / 1.25) - sum(outgoing_amount)) as result
FROM myDB WHERE year(timestamp) = '2011' order by id desc");
谁能指出我正确的方向?