All,
I need your help to merge the result in the same datetime in mysql.
I do a query of two tables like :
SELECT b.ID, b.DateTime, b.Value
FROM tableA a, tableB b
WHERE (a.Id=1) OR (a.Id=2) OR (a.Id=3) AND (a.Id = b.ID)
AND (b.DateTime Between '2011-04-02 06:00' And '2011-04-02 06:05')
Query result :
| ID | DateTime | Value |
----------------------------------
| 1 | 2011-04-02 06:00 | 20 |
| 1 | 2011-04-02 06:05 | 21 |
| 2 | 2011-04-02 06:00 | 10 |
| 2 | 2011-04-02 06:05 | 16 |
| 3 | 2011-04-02 06:00 | 23 |
| 3 | 2011-04-02 06:05 | 22 |
All i want is to make a result like :
| DateTime | ID_1 | ID_2 | ID_3 |
------------------------------------------------
| 2011-04-02 06:00 | 20 | 10 | 23 |
| 2011-04-02 06:05 | 21 | 16 | 22 |
I hope there is a solution for this.
Thank you before for all your help.
Regards,
YougyZ