我有一堆单独的小选择查询,我需要将它们放入一个视图或两个视图中,最终可能会加入并需要建议。我正在使用第三方临时应用程序,它不能很好地处理存储过程,因此临时表不适合。有人对如何实现这一点有任何建议吗?以下是查询:
select count(cmrckid)as TotalRDIs
FROM tblCMRCK
select count(AccountID)as TotalMerchants
FROM tblAccounts
select count(AccountID)as TotalActiveMerchants
FROM tblAccounts
where inactive = 0
select count(AccountID)as TotalInActiveMerchants
FROM tblAccounts
where inactive = 1
select count(AccountID)as TotalwithRDIs
FROM [tblAccounts] a WITH (NOLOCK) inner join
[tblcmrck] c WITH (NOLOCK) on a.configid=c.configid and a.accountid=c.acctid
select COUNT(AccountID) as ActivewithRDIs
FROM [tblAccounts] a WITH (NOLOCK) inner join
[tblcmrck] c WITH (NOLOCK) on a.configid=c.configid and a.accountid=c.acctid
where a.Inactive = 0
select COUNT(AccountID) as ActivewithoutRDIs
FROM [tblAccounts] a WITH (NOLOCK)
where a.inactive = 0 and a.AccountID not in (select AcctID from tblCMRCK)
--select 'Total Active Merchants' / 'Total Merchants' as 'PctActive'
--from #tmptable
--select 'Total InActive Merchants' / 'Total Merchants' as 'PctInActive'
--from #tmpTableExample2
--select 'Active with RDIs' / 'Total Merchants' as 'PctActivewithRDIs'
--FROM #tmpTableExample
--select 'Active without RDIs' / 'Total Merchants' as 'PctActivewithoutRDIs'
--FROM #tmpTableExample