Skip to content
Advertisement

How to Get list of ids from same query when returning as JSON

apps table

I have a query,

SELECT * FROM apps WHERE app_status = "ACTIVE" FOR JSON PATH;

This query has an app_id field. I also want a field to accompany the json output with a field ids with all the app_id as a list.

So instead of:

I would have:

Advertisement

Answer

This returns the correct JSON

Data

Query

Output

User contributions licensed under: CC BY-SA
6 People found this is helpful
Advertisement