I have a table with 3 columns, I want to query that table such that the result will be a JSON object.
Sample data looks like this:
CREATE TABLE #Test (
Try this:
SELECT (SELECT [ID], [Keys], [ValueV] FOR JSON PATH) FROM #Test GROUP BY ID, keys, ValueV
or this:
SELECT (SELECT [ID], [Keys], [ValueV] FOR JSON PATH, WITHOUT_ARRAY_WRAPPER) FROM #Test GROUP BY ID, keys, ValueV