Last active
September 19, 2015 10:25
-
-
Save zmiftah/e0889c4b5a3034c69f8e to your computer and use it in GitHub Desktop.
Postgres Json func
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- Row to json (per row) | |
SELECT row_to_json(project) FROM ( | |
SELECT * FROM pdg.project WHERE id=1750 | |
) project | |
-- Ex | |
SELECT row_to_json(datum) FROM (SELECT 'ID' AS id, 'Name' AS name) AS datum | |
-- Aggregate Row to Array json | |
SELECT json_agg(project) FROM ( | |
SELECT * FROM pdg.project WHERE id=1750 | |
) project |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment