Given a table like this:
==============================================
| ID1 | ID2 | ID3 | Name | Value |
==============================================
| 16 | 1 | 100 | item_name | Toys |
| 16 | 2 | 101 | item_name | Computer |
| 16 | 1 | 102 | item_price | 55 |
| 16 | 2 | 103 | item_price | 200 |
| 16 | 1 | 104 | animal_name | dog |
| 16 | 2 | 105 | animal_name | cat |
| 16 | 1 | 106 | animal_gender | male |
| 16 | 2 | 107 | animal_gender | female |
| 18 | 1 | 100 | item_name | Toys |
| 18 | 2 | 101 | item_name | Computer |
| 18 | 1 | 102 | item_price | 55 |
| 18 | 2 | 103 | item_price | 200 |
| 18 | 1 | 104 | animal_name | dog |
| 18 | 2 | 105 | animal_name | cat |
| 18 | 1 | 106 | animal_gender | male |
| 18 | 2 | 107 | animal_gender | female |
----------------------------------------------
How do I use SQL to make it like this:
==============================================================
| ID1 | item_name | item_price | animal_name | animal_gender |
==============================================================
| 16 | Toys | 55 | dog | male |
| 16 | Toys | 55 | cat | female |
| 16 | Computer | 200 | dog | male |
| 16 | Computer | 200 | cat | female |
| 18 | Toys | 55 | dog | male |
| 18 | Toys | 55 | cat | female |
| 18 | Computer | 200 | dog | male |
| 18 | Computer | 200 | cat | female |
--------------------------------------------------------------
I will be creating the SQL query in PHP.