title: One-to-Many SQL SELECT into single row
body: <p>I have data in two tables.</p>
  
  <p>The first table has a Primary Key called PKID</p>
  
  <pre><code>PKID  DATA
  0    myData0
  1    myData1
  2    myData2
  </code></pre>
  
  <p>The second table has the PKID column from table 1 as a foreign key</p>
  
  <pre><code>PKID_FROM_TABLE_1  U_DATA
         0          unique0
         0          unique1        
         0          unique2
         1          unique3
         1          unique4
         1          unique5
         2          unique6
         2          unique7
         2          unique8
  </code></pre>
  
  <p>The basic SELECT statement I am making now is</p>
  
  <pre><code>SELECT a.PKID, a.DATA, b.U_DATA
  FROM table1 as a
  INNER JOIN table2 as b
  ON a.PKID = b.PKID_FROM_TABLE_1
  </code></pre>
  
  <p>This produces a table like this:</p>
  
  <pre><code>PKID   DATA     U_DATA
   0   myData0    unique0
   0   myData0    unique1
   0   myData0    unique2
   1   myData1    unique3
   1   myData1    unique4
   1   myData1    unique5
   2   myData2    unique6
   2   myData2    unique7
   2   myData2    unique8
  </code></pre>
  
  <p>What I would like is the following table:</p>
  
  <pre><code>PKID   DATA    U_DATA1    U_DATA2    U_DATA3
   0     myData0 unique0    unidque1   unique2
   1     myData1 unique3    unidque4   unique5
   2     myData2 unique6    unidque7   unique8
  </code></pre>
  
  <p>If it helps, each PKID will have exactly 3 entries in table2.</p>
  
  <p>Is something like this possible in MySQL?</p>