我有一個數據庫與我的在線網上商店的所有交易,並試圖進行查詢打印出一個簡單的財務報表。幫助一個MySQL查詢
它會在一個表格打印:
<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");
任何人都可以點我在正確的方向?
你真的有一個名爲'myDB'的表嗎? –