How can I merge the two select statements into one so I see the Budget / Billing / Booking columns in the same result?
DECLARE @thismonth varchar(7) SET @thismonth = CONVERT(varchar(4),GETDATE(),120) + '-' + CONVERT(varchar(2),GETDATE(),101) SELECT [Target] AS [Budget GP] FROM dbo.tblTarget WHERE [SalesChannel] = 'HR' AND [Period] = @thismonth SELECT SUM(ISNULL(CASE WHEN [Trx Type]='credit' THEN (GP * -1) WHEN [Trx Type]='invoice' THEN (GP) END , 0)) AS [Billing] , SUM(ISNULL(CASE WHEN [Trx Type]='booking' THEN GP END , 0)) AS [Booking] FROM dbo.tblTransactions WHERE [Sales Channel] = 'HR' AND [Doc Date YYYY-MM] = @thismonth
Gain unlimited access to on-demand training courses with an Experts Exchange subscription.Get Access
When asked, what has been your best career decision?
Deciding to stick with EE.
Being involved with EE helped me to grow personally and professionally.