Create View and Convert Rows into Column in MySQL
<p>I have a table; Table A.</p>

<pre><code>+-----+----------+
|month|value_deal|
+-----+----------+
|JAN  |10        |
+-----+----------+
|JAN  |20        |
+-----+----------+
|FEB  |30        |
+-----+----------+
|FEB  |40        |
+-----+----------+
</code></pre>

<p>I want to convert the rows value_deal as columns with the same month and make it as view, like this.</p>

<pre><code>+-----+-----------+-----------+
|month|value_deal1|value_deal2|
+-----+-----------+-----------+
|JAN  |10         |20         |
+-----+-----------+-----------+
|FEB  |30         |40         |
+-----+-----------+-----------+
</code></pre>

<p>I've tried using dynamically convert rows to column in <a href="https://stackoverflow.com/questions/14834290/mysql-query-to-dynamically-convert-rows-to-columns">here</a>. But I can't insert the code inside Create View functions.</p>

<p>Can anyone help? pls</p>