朋友们。我对以下查询感到困惑。
c = db.rawQuery("SELECT strftime('%W', tm.txn_date) AS week,
sum(case when cm.master_id = 1 then (tm.amount - tm.pre_amount) else 0 end) AS Income,
sum(case when cm.master_id = 2 then (tm.pre_amount - tm.amount) else 0 end) AS Expense
FROM transmaster tm
INNER JOIN subcatmasters scm ON tm.scmaster_id = scm.id
INNER JOIN catmasters cm ON scm.catmaster_id = cm.id
WHERE strftime('%m', tm.txn_date) = '05'
GROUP BY week ORDER BY week DESC", null);
这个工作完美,但是。
c = db.rawQuery("SELECT strftime('%W', tm.txn_date) AS week,
sum(case when cm.master_id = 1 then (tm.amount - tm.pre_amount) else 0 end) AS Income,
sum(case when cm.master_id = 2 then (tm.pre_amount - tm.amount) else 0 end) AS Expense
FROM transmaster tm
INNER JOIN subcatmasters scm ON tm.scmaster_id = scm.id
INNER JOIN catmasters cm ON scm.catmaster_id = cm.id
WHERE strftime('%m', tm.txn_date) = '"+05+"'
GROUP BY week ORDER BY week DESC", null);
这个没用。有什么问题朋友。
我只是WHERE strftime('%m', tm.txn_date) = '05'
将此行更改为WHERE strftime('%m', tm.txn_date) = '"+05+"'
为什么,因为我想明确给出月份编号。
请帮我。提前致谢。