SELECT statusid,COUNT(statusid),SUM(totalamount)
FROM intrahrms_rems_reimbursement
WHERE projectmanagerid='KA18041E' GROUP BY statusid
这是我的查询,我得到了结果。但我想将此查询用于businessunitid和accountsid .. 我可以把这个查询写成
SELECT statusid,COUNT(statusid),SUM(totalamount)
FROM intrahrms_rems_reimbursement
WHERE businesunitid='KA18049E' GROUP BY statusid
和帐户相同
SELECT statusid,COUNT(statusid),SUM(totalamount)
FROM intrahrms_rems_reimbursement
WHERE accountsid='KA18043E' GROUP BY statusid
那么我该如何编写可以根据项目经理或业务部门或帐户执行的查询