The result that you need to obtain can be obtained using a simple case statement or a using a Pivot and aggregation. I personally prefer PIVOT because it can do various data transformations and we can obtain data in any way as we wish. Here I added both solutions.
Solution 01: Using PIVOT and later Aggregate the result. This seems more complicated as you nee to know both PIVOT and the Aggregate functions.
SELECT [B].[OrderDate]
, SUM([B].[P1]) AS [P1]
, SUM([B].[P2]) AS [P2]
, SUM([B].[P3]) AS [P3]
, SUM([B].[P5]) AS [P5]
FROM
(
SELECT [PIVOTED].[OrderDate]
, ISNULL( [PIVOTED].[P1] ,'') AS [P1]
, ISNULL( [PIVOTED].[P2], '') AS [P2]
, ISNULL( [PIVOTED].[P3], '') AS [P3]
, ISNULL( [PIVOTED].[P5], '') AS [P5]
FROM(
SELECT
[T1].[OrderDate],
[T1].[ProductId],
[T2].[ProductName],
[T1].[Quantity]
FROM [TABLE_1] [T1]
INNER JOIN [TABLE_2] [T2]
ON [T1].[ProductId] = [T2].[ProductId]
) P
PIVOT
(
SUM([P].[Quantity])
FOR [P].[ProductName] IN ([P1],[P2],[P3],[P5])
) PIVOTED
) AS B
GROUP BY [B].[OrderDate]
Result:
Result for Solution 01:
Solution 02: Using a simple case statement:
SELECT
T1.OrderDate,
[P1] = SUM(CASE WHEN T2.ProductName = 'P1' THEN Quantity END),
[P2] = SUM(CASE WHEN T2.ProductName = 'P2' THEN Quantity END),
[P3] = SUM(CASE WHEN T2.ProductName = 'P3' THEN Quantity END),
[P5] = SUM(CASE WHEN T2.ProductName = 'P5' THEN Quantity END)
FROM TABLE_1 T1
JOIN TABLE_2 T2 ON T1.[ProductId] = T2.[ProductID]
GROUP BY T1.[OrderDate]
Result 02:
Result for Solution 02:
Note: You need to handle new products as they are added to the tables. As you can see both solutions hardcode the product names, you need to handle it. If you need a more generic solution, let me know. I will provide a dynamic PIVOT where you do not need to handle the new products as they are added.