My database looks like this:
Raw Table Data :
The Result returned :
from the query below :
SELECT ROW_NUMBER() OVER ( ORDER BY stokkodu ) AS RowNum,
stokkodu,
adi,
beden,
renk,
kalan,
afiyat
FROM (SELECT stokkodu, adi, afiyat, renk, SUM(kalan) AS kalan, beden
FROM [viabase].[dbo].[Q_KALANS]
GROUP BY stokkodu, adi, afiyat, renk, beden) AS products
Now I need to get the sizes of the products grouped under separate color nodes to fetch from the DB to present to the client site as in the JSON Format like this :
How can I do that? Is it possible?



MERGEhas a specific meaning in SQL; ity an operator that can be used toINSERT,UPDATEandDELETEagainst an object in a single statement. What you seem to want here is some form of malformed JSON.