I'm tying to query if possible to separate the values into different columns using the same table
so here is my sample table:
select date, tool, value from table
+----------------------+-----------+-------+
| date | tool | value |
| | | |
| 2017-03-11 13:03:38 | machineA | 14 |
| 2017-03-11 13:03:39 | machineA | 18 |
| 2017-03-11 13:03:40 | machineB | 50 |
| 2017-03-11 13:03:41 | machineB | 50 |
+----------------------+-----------+-------+
And trying to have output like this: On my code I am looping this query then put in the dataset then re-organize the values, But now I'm not sure which function is reliable on this query should I need to do the joins or union or have some conditions.
+----------------------+-----------+----------+
| date | machineA | machineB |
| | | |
| 2017-03-11 13:03:38 | 14 | 0 |
| 2017-03-11 13:03:39 | 18 | 0 |
| 2017-03-11 13:03:40 | 0 | 50 |
| 2017-03-11 13:03:41 | 0 | 50 |
+----------------------+-----------+----------+
any suggestion and recommendation thanks in advance.