title: List child items in columns for parent view
body: <p>I had a table with a structure like:</p>
  
  <pre><code>+----+-----------+-----------+-----+-----------+-----------+-----+-----------+
  | id | chld1fld1 | chld1fld2 | ... | chld1fld5 | chld2fld1 | ... | chld6fld5 |
  +----+-----------+-----------+-----+-----------+-----------+-----+-----------+
  </code></pre>
  
  <p>I remodeled it to get a proper parent-child relationship. Thing is that, for compatibility reasons with legacy systems, I'd like to have a view that reproduced the old structure. I managed to do it with subqueries:</p>
  
  <pre><code>SELECT parent.id,
      (SELECT c.field1 FROM child c WHERE (c.parent_id = parent.id) AND (id = 1)) AS chld1fld1,
      (SELECT c.field2 FROM child c WHERE (c.parent_id = parent.id) AND (id = 1)) AS chld1fld2,
      ...
      (SELECT c.field5 FROM child c WHERE (c.parent_id = parent.id) AND (id = 6)) AS chld6fld5
  FROM parent
  </code></pre>
  
  <p>But I'm worried about the number of fetches that are needed for this operation. So is there a better way to do this? Maybe if I could at least fetch all child fields in a single subquery, it would be a lot better already.</p>