join 3 tables with 1 of the tables rows becoming columns
<p>I'll try to explain my goal as best I can: </p>

<p>3 tables -</p>

<p>select * from users;</p>

<pre><code>+--------+----------+
|   id   | firstname|
+--------+----------+
|    1   |  John    |    
|    2   |  Mary    |
+--------+----------+
</code></pre>

<p>select * from links;</p>

<pre><code>+--------+---------+-----------------+
|user_id | link_id | viewname        |
+--------+---------+-----------------+
|   1    |   11    | John and Jane   |
|   2    |   13    | Mary and Mike   |
+--------+---------+-----------------+
</code></pre>

<p>select * from values;</p>

<pre><code>+--------+----------+-----------+
|link_id |value_id  |link_value |
+--------+----------+-----------+
|   11   |   2      |  Image1   |
|   11   |   5      |  Steak    |
|   13   |   5      |  Chicken  |
|   11   |   3      |  Blue     |
|   11   |   4      |  Option1  |
|   13   |   1      |  Yes      |
|   13   |   2      |  Image2   |
|   13   |   4      |  Option1  |
|   13   |   3      |  Green    |
|   11   |   1      |  No       |
+--------+----------+-----------+
</code></pre>

<p>My goal is to join the three tables and make the contents of value_id a column header. Like this-</p>

<pre><code>+------------+---------------+------+--------+---------+---------+---------+
| firstname  |    viewname   |   1  |   2    |    3    |   4     |   5     |    
+------------+---------------+------+--------+---------+---------+---------+
|   John     | John and Jane |  No  | Image1 |   Blue  | Option1 | Steak   |
|   Mary     | Mike and Mary |  Yes | Image2 |   Green | Option1 | Chicken |
+------------+---------------+------+--------+---------+---------+---------+
</code></pre>

<p><a href="http://sqlfiddle.com/#!9/6178b" rel="nofollow">MySQLfiddle</a></p>

<p>I have tried and tried and failed. Any help/suggestions at this point would be appreciated.</p>