結果を生成する 2 つのクエリがあります。
Date Count of Converted Leads
07/22/2013 3
07/23/2013 10
07/24/2013 4
07/25/2013 5
07/26/2013 3
07/27/2013 3
--and
Date Count of All Leads
07/22/2013 105
07/23/2013 517
07/24/2013 291
07/25/2013 170
07/26/2013 122
07/27/2013 79
07/28/2013 86
これらを 3 つの列の結果に結合したい:
Date Count of Converted Leads Count of All Leads
エラーを取得する」サブクエリが複数の値を返しました
Select convert(varchar(10), [LeadCreatedDate], 101) as Date
,(select count(leadid)
from [dbo].[SalesforceProspectConversion]
where [LeadCreatedDate] between '2013-07-22' and '2013-07-29'
and [LeadSourceOriginal] != 'Jigsaw'
and [LeadSourceOriginal] != 'Other'
and [LeadConverted] = 'Y'
Group by convert(varchar(10), [LeadCreatedDate], 101)) as 'Count of Converted Leads'
,(select count(leadid)
from [dbo].[SalesforceProspectConversion]
where [LeadCreatedDate] between '2013-07-22' and '2013-07-29'
and [LeadSourceOriginal] != 'Jigsaw'
and [LeadSourceOriginal] != 'Other'
Group by convert(varchar(10), [LeadCreatedDate], 101)) as 'Count of All Leads'
from [dbo].[SalesforceProspectConversion]
where [LeadCreatedDate] between '2013-07-22' and '2013-07-29'
and [LeadSourceOriginal] != 'Jigsaw'
and [LeadSourceOriginal] != 'Other'
Group by convert(varchar(10), [LeadCreatedDate], 101)