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 (
Posting this if any one has the same sort of use case
SELECT [t].[ID], (SELECT [t1].[KEYS], [t1].[ValueV] FROM @Test t1 WHERE t1.[ID] = [t].id FOR JSON PATH ) a FROM @Test AS [t] GROUP BY [t].[ID]