Join tables and pivot
Pivoting should be broken into two steps.

Step 1:  Create a SELECT with the data not yet pivoted:

SELECT product, date, qty
    FROM ...


In your case, that query is likely to have a JOIN.  (I am uncomfortable with which table date is in, but that is a separate issue.)

Step 2:  Do the Pivoting.

SELECT product,
       ( ... ) AS '2018-06-01',
       ( ... ) AS '2018-06-02',
       ...
    FROM ( the-above-SELECT ) AS x


There could be issues with step 2 -- As shown, it requires a fixed number of columns.  If you have a variable number of columns, you cannot build it this way, but need to construct the SELECT dynamically, then 'execute' it.

More discussion:  http://mysql.rjweb.org/doc.php/pivot