MySQL query to view vertical data

Posted by wenkhairu on Stack Overflow See other posts from Stack Overflow or by wenkhairu
Published on 2012-10-26T04:56:30Z Indexed on 2012/10/26 5:00 UTC
Read the original article Hit count: 304

Filed under:
|
|

I have MySQL data that looks like this:

+----------------------------------------+
|Name                | kode      | jum   |
+----------------------------------------+
| aman               |kode1      | 2     |
| aman               |kode2      | 1     |
| jhon               |kode1      | 4     |
| amir               |kode2      | 4     |
+--------------------+-----------+-------+

How can I make the table look like this one, using a MySQL query?

                    kode1    kode2     count
aman                  2         1        3  
jhon                  0         4        4
amir                  0         4        4

© Stack Overflow or respective owner

Related posts about mysql

Related posts about sql