Experts Exchange Solution brought to you by
"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.
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
This course will teach participants about installing and configuring Python, syntax, importing, statements, types, strings, booleans, files, lists, tuples, comprehensions, functions, and classes.
DECLARE @x NVARCHAR(MAX) = (SELECT ... FOR JSON )
Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.
From novice to tech pro — start learning today.
Members can enroll in this course at no extra cost.