I have two tables.
An orders table with customer, and date. A date dimension table from a data warehouse.
The orders table does not contain activity for ev
Here is a simple way to do it:
SELECT A.Customer,
B.fulldate [Date],
ISNULL(C.Amount,0) Amount
FROM ( SELECT Customer,
MIN([Date]) MinDate,
MAX([Date]) MaxDate
FROM Orders
GROUP BY Customer) A
LEFT JOIN DateTable B
ON B.fulldate BETWEEN A.MinDate AND A.MaxDate
LEFT JOIN Orders C
ON A.Customer = C.Customer
AND B.fulldate = C.[Date]