0
select
IFNULL(sum(invoice0_.INV_AMT),0) as col_0_0_,IFNULL(sum(invoice1_.INV_AMT),0) as col_0_0_
from
hrmanager.invoice invoice0_,
hrmanager.invoice invoice1_
where
invoice0_.FROM_LEDGER=1
**or** invoice1_.TO_LEDGER=1
and (
invoice0_.INV_DATE between '1900-12-20' and '2012-01-30'
)
and invoice0_.ACTIVE='Y'
and invoice0_.COMP_ID=2
and invoice1_.COMP_ID=2
and invoice0_.INV_TYPE='CLIENT'
and invoice1_.INV_TYPE='CLIENT';
在這裏,我要選擇所有from_ledger = 1和下一列的量的總和應顯示所有to_ledger = 1的量的總和,但這裏給了和/或在條件檢索相同的數據,在Db這裏從分類帳= 1然後結果是7000和toledger = 1然後它將0但上述查詢檢索兩列是相同的值,如0或7000MySQL查詢使用檢索值if語句