我有一个交易表,我想要总结不同日期的总金额,贝娄是我的代码
SELECT SUM( total_amount ) AS total FROM transaction WHERE execution_date BETWEEN "2015-08-1" AND "2015-08-31" AND execution_date BETWEEN "2015-09-1" AND "2015-09-30"
代码只返回Null。欢迎任何帮助。
答案 0 :(得分:0)
您应该<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>
代替OR
。由于您希望显示AND
和2015-08-1" AND "2015-08-31
范围内的交易,
哪个是矛盾,结果2015-09-1" AND "2015-09-30
null
OR
SELECT SUM( total_amount ) AS total FROM transaction
WHERE execution_date BETWEEN "2015-08-1" AND "2015-08-31"
OR execution_date BETWEEN "2015-09-1" AND "2015-09-30"
希望这有帮助