PeopleSoft Adoption Made Smooth & Simple!
On-The-Job Training Is made Intuitive & Easy With WalkMe's On-Screen Guidance Tool. Claim Your Free WalkMe Account Now
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
Add your voice to the tech community where 5M+ people just like you are talking about what matters.
Join the community of 500,000 technology professionals and ask your questions.