Table A name is source
ID | date | valueS | commonID
1 26.8.14 Svalue01 11
2 21.8.14 Svalue02 11
3 25.8.14 Svalue03 11
Table B name is destination
ID | date | valueD | commonID
1 26.8.14 Dvalue01 11
2 21.8.14 Dvalue03 11
3 24.8.14 Dvalue03 11
So currently im using
SELECT a.*, b.* FROM (SELECT * FROM Source WHERE commonID = '11')a JOIN destination b ON a.commonID = b.commonID
But this dont get me the wished result.
i want something sorted by date, and if there is no record for both on the date, one is zero.
example how it should look
ID | date | valueD | commonID | ID | date | valueS | commonID
1 26.8.14 Dvalue01 11 1 26.8.14 Svalue01 11
3 25.8.14 Svalue03 11
3 24.8.14 Dvalue03 11
2 21.8.14 Dvalue03 11 2 21.8.14 Svalue02 11
Is and how would this be possible?
Additional Info:
-Using Mysql 5.5.37 (MariaDB) -ID is primary on both -date fields are "timestamp" -value fields are INT -ID fields are INT -Engine is InnoDB
I hope i provided enough information and tried to make a good explained question
thank you for your help