1 SELECT Depots.Name AS 'Depot', Account.Name, '22/01/2012', '29/01/2012', '05/02/2012', '12/02/2012',
2 FROM
3(SELECT Name,
4 FROM Deliveries
5 INNER JOIN Account ON Deliveries.Customer = Account.ID
6 INNER JOIN Depots ON Account.CollectionDepot) AS Source
7PIVOT
8(
9 SUM(Deliveries.Rates)
10 FOR Date IN ('22/01/2012', '29/01/2012', '05/02/2012', '12/02/2012')
11) AS 'Pivot Table'
12