What is the mysql I need to achieve the result below given this table:
table:
+----+-------+--------------
| name| id | items | vol
+----+-------+---------------
| A | 1111 | 4 | 170
| A | 1111 | 5 | 100
| B | 2222 | 6 | 200
| B | 2222 | 7 | 120
+----+-------+-----------------
Above table is the result of union query
SELECT * FROM imports
union all
SELECT * FROM exports
ORDER BY name;
I want to create a temporary view that looks like this
desired result:
+----+---------+---------+-------------------
| name| id | items | vol | items1 | vol2
+-----+--------+-------+--------------------
| A | 1111 | 4 | 170 | 5 | 100
| B | 2222 | 6 | 200 | 7 | 120
+----+---------+---------+-------------------
any help would be greatly appreciated! -Thanks