Improve company productivity with a Business Account.Sign Up
Are you ready to take your data science career to the next step, or break into data science? With Springboard’s Data Science Career Track, you’ll master data science topics, have personalized career guidance, weekly calls with a data science expert, and a job guarantee.
SELECT t = (SELECT
cp.id AS cpid
,cp.customerSrcRef AS cr
,cp.productSrcRef AS pr
,CONVERT(DATE, cp.validFrom) AS vf
,CONVERT(DATE, cp.validTo) AS vt
--,CONVERT(DECIMAL(10, 2), ((cp.rate/100) * pr.rate) + pr.rate) AS p
,cp.price as p
,cp.active AS en
,cp.modifiedDate AS md
FROM dbo.accountManagerCustomer amc
INNER JOIN dbo.customerPrice cp ON amc.customerSrcRef = cp.customerSrcRef
WHERE amc.enabled = 1 AND amc.deleted=0
AND cp.validTo >= CAST(GETDATE() AS DATE) AND cp.active = 1
--AND ((@isFullCustomersAM = 0 AND amc.accountManagerRef = @accountManagerId) OR @isFullCustomersAM != 0)
ORDER BY cp.id
FOR JSON PATH, ROOT ('root'))
Open in new window
DECLARE @x NVARCHAR(MAX) = (SELECT ... FOR JSON )
Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.
Have a better answer? Share it in a comment.
Please enter a first name
Please enter a last name
Must be at least 4 characters long.
Join and Comment
From novice to tech pro — start learning today.
Premium members can enroll in this course at no extra cost.