There is my problem :
enter code here
I have a table called test that looks like this
id| service | sub service | Qt | date
1 | service_1 | sub_service_11 | 3 | 2011-12-03
2 | service_1 | sub_service_12 | 6 | 2011-12-03
3 | service_1 | sub_service_13 | 4 | 2011-12-03
Later I have a table called datedim that looks like this
id| date
1 | 2011-12-01
2 | 2011-12-02
3 | 2011-12-03
4 | 2011-12-04
5 | 2011-12-05
What I am trying to do is that for each sub_service bring back all the date from datedim even if there is no match.
So basically something that would look like this
sub_service_11 | 2011-12-01 | NULL
sub_service_11 | 2011-12-02 | NULL
sub_service_11 | 2011-12-03 | 3
sub_service_11 | 2011-12-04 | NULL
sub_service_11 | 2011-12-05 | NULL
sub_service_12 | 2011-12-01 | NULL
sub_service_12 | 2011-12-02 | NULL
sub_service_12 | 2011-12-03 | 6
sub_service_12 | 2011-12-04 | NULL
sub_service_12 | 2011-12-05 | NULL
sub_service_13 | 2011-12-01 | NULL
sub_service_13 | 2011-12-02 | NULL
sub_service_13 | 2011-12-03 | 4
sub_service_13 | 2011-12-04 | NULL
sub_service_13 | 2011-12-05 | NULL
I did try RIGHT JOIN, UNIONS and stuff but I can’t figure it out.
Does anyone know how I can accomplish that ?
Thank you,
This is what you need: