title: SQL: Return left join as object
body: <p>Fairly new to SQL so I'm very sorry if this is not possible at all.</p>
  <p>I'm essentially using SQL queries to get data from my database and then passing them to a Graphql API. This has worked great up until now as my queries were fairly simple:</p>
  <pre><code>SELECT * from a_single_table
  </code></pre>
  <p>I've now gotten to the point where with those simple requests, I would like to <code>JOIN</code> other data from a different table, for example the user associated with the specific resource:</p>
  <pre><code> id | username  
  ----+------------
    1 | User1
    2 | User2
    3 | User3
  </code></pre>
  <p>I can easily join the two by doing something like (pseudo-query warning):</p>
  <pre><code>SELECT *, u.username, u.id FROM a_single_table AS s LEFT JOIN users_table AS u ON (s.authorId = u.id)
  </code></pre>
  <p>Unfortunately if I do this the structure of the data I get back is a flat table, so it'll look something like:</p>
  <pre><code>{
    id: 1,
    title: &quot;The title of the resource selected&quot;,
    username: &quot;User1&quot;
    userId: 1
  }
  </code></pre>
  <p>It would be much better for Graphql's syntax if it was return like this:</p>
  <pre><code>{
    id: 1,
    title: &quot;The title of the resource selected&quot;,
    user: {
      userId: 1,
      username: &quot;User1&quot;
    }
  }
  </code></pre>
  <p>Is this at all possible? Currently using Postgresql if that makes any difference.</p>