Skip to content

Instantly share code, notes, and snippets.

@Volmarg
Created February 20, 2021 15:14
Show Gist options
  • Save Volmarg/81b193c1cda8cda5aef6536f684168d4 to your computer and use it in GitHub Desktop.
Save Volmarg/81b193c1cda8cda5aef6536f684168d4 to your computer and use it in GitHub Desktop.
Selecting data from database as json
SELECT CONCAT(
'[',
GROUP_CONCAT(JSON_OBJECT(
'id', id,
'name', name,
'color', color,
'background_color', background_color,
'drag_background_color', drag_background_color,
'border_color', border_color,
'deleted', deleted
)),
']'
)
FROM my_schedule_calendar;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment