Skip to content

Instantly share code, notes, and snippets.

@RyotaBannai
Last active December 19, 2018 18:48
Show Gist options
  • Save RyotaBannai/b0f43acb30db58d2b9ed152c61f26362 to your computer and use it in GitHub Desktop.
Save RyotaBannai/b0f43acb30db58d2b9ed152c61f26362 to your computer and use it in GitHub Desktop.
db=# \t //1st command
db=# \a //2nd command
db=# \o file.json //3rd command
db=# SELECT json_agg(json_build_object( //4thcommand
'pk', t.id,'model','meryota.question', 'fields',
json_build_object('question_text',t.question_text,
'pub_date',t.pub_date))) from meryota_question as t;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment