これはちょっとトラブルシューティングを試みましたが、経験豊富な人にとっては簡単かもしれないと思っていましたが、それでもエラー1054が発生します。単一の数字を入力してください。エラーコード:1054. 'フィールドリスト'の 'next_price'列が不明確
select sum(next_price)
from
(
select sum(sub.next_price)
from sub
left join account on account.acctid = sub.acctid
where sub.date_created >= curdate()
and sub.date_created < curdate()+1
and account.type <> 'internal'
UNION ALL
select sum(sub.next_price)*-1
from sub
left join account on account.acctid = sub.acctid
where sub.date_closed >= curdate()
and sub.date_closed < curdate()+1
and account.type <> 'internal'
) as Temp
group by next_price
:
は、このクエリを試してみてください? –@KobyDouek nop、それはTempという一時的なテーブルなので、おそらく 'Temp.next_price'ですが、subはありません。 – teeyo
あなたは組合の次の価格を別名にしませんでした。 'select sum(sub.next_price)'は 'select sum(sub.next_price)next_price'である必要があります。さらに、なぜnext_priceを集計してグループ分けしていますか? – xQbert