SELECT `Type`, `Originating Country Code`,`Originating Currency Code`, SUM(`Principal Amount`) as Total
FROM `colab`
WHERE (`Destination Country Code`='PH'
AND `Destination Currency Code`='PHP'
AND `Type` = 'PAID') || (`Destination Country Code`='PH'
AND `Destination Currency Code`='USD'
AND `Type`= 'PAID')
GROUP BY `Type`
是工作的罰款,並返回true,請參見下面的
country_code | Currency_Code | Type | Principal
=======================================================
| PH | PHP | PAID | 200
=======================================================
我的問題是我想單獨貨幣的本金總額與美元值。請參閱記錄我的數據庫裏面
country_code | Currency_Code | Type | Principal
=======================================================
| PH | PHP | PAID | 100
| PH | USD | PAID | 100
=======================================================
喜先生夢食者,任何想法我怎麼能做出另一個條件? – phphopzter 2013-03-10 03:24:32
@phphopzter你可以更具描述性的條件?就像你想'type'字段是'W'或者你的'country_code'是'PH'或者類似的東西? – hjpotter92 2013-03-10 03:26:36
嗨,謝謝,我只想插入另一個WHERE子句?但我認爲它不能在我的查詢權?這就是爲什麼即時查找mySQL查詢功能,以保持1個或更多的條件。謝謝 – phphopzter 2013-03-10 03:30:39