title: How to combine JSON_OBJECTS from a select command mySQL
body: <p>I am trying to export json data from a mySQL table where the row becomes an entry in the dictionary. I have been able to make entries for every row using the code below.</p>
  
  <pre><code>SELECT JSON_OBJECT(p.link, 
  JSON_OBJECT("location", p.location , "finish", p.finish, "start-date", p.startdate, "position", p.position)) 
  FROM regattas p WHERE sailor_uuid="name"
  </code></pre>
  
  <p>Which returns a bunch of rows that look like this.</p>
  
  <pre><code>{\"link\": {\"finish\": \"2/8\", \"location\": \"college\", \"position\": \"Crew\", \"start-date\": \"2019-03-30\"}}
  </code></pre>
  
  <p>Which is what I want, but I want each of those link:dict entries to be apart of one big json document. I tried surrounding it with a merge, but I was still getting problems because the json object only counts as one parameter. Is there some way to use all the things that the select from the first code block above returns as parameters. </p>
  
  <pre><code>SELECT JSON_MERGE(JSON_OBJECT(p.link, JSON_OBJECT("location", p.location , "finish", p.finish, "start-date", p.startdate, "position", p.position))) FROM regattas p WHERE sailor_uuid="name"
  </code></pre>
  
  <p>I might be missing some super simple answer as I'm super new to mySQL, any help is greatly appreciated.</p>