我有两个 SQL 查询
select count ( distinct w.processno ) AS "Number of Processes", y.userid from upmfolder f, upmperson p, w2process w, w2processcheck y where f.personid = p.personid and f.folderid = w.keynumb and w.Processno = y.processid and w.keyobject ='UPMFolder' group by 2
另一个类似的是:
select count ( distinct w.processno ) AS "Number of Processes", y.userid from upmfolder f, upmperson p, w2process w, w2processcheck y where f.personid = p.personid and f.payrollmemberid = w.keynumb and w.keyobject = 'UPMPayrollmember' and w.Processno = y.processid group by 2
我如何将两者组合成一个查询?所以计数和组仍然可以正常工作。我试过了union all
,但这没有用。我需要做什么?