OK、次のようなテーブルがあります。
ID AMOUNT PAID
1 50.00 Y
2 100.00 N
3 200.00 Y
そして、私は次のようなものを見たいです:
Total Due Paid
350.00 1 2
したがって、私のSQLは次のようになります(私の頭の中では...それはそのようには機能しません。それが私がここにいる理由です)
select sum(amount)
,count(paid where paid='y') as due
,count(paid where paid='n') as paid
from sometable where something=somethingelse