Assuming you use a DB which supports PIVOT, you should use it. Here's example code for Oracle:
CREATE TABLE Consumption (
DocDate DATE,
ItemCode VARCHAR2(10),
Quantity NUMBER
);
INSERT INTO Consumption VALUES(to_date('2009-01-01', 'YYYY-MM-DD'), 'A', 5);
INSERT INTO Consumption VALUES(to_date('2009-02-01', 'YYYY-MM-DD'), 'A', 6);
INSERT INTO Consumption VALUES(to_date('2009-01-01', 'YYYY-MM-DD'), 'B', 5);
SELECT * FROM Consumption
PIVOT(
sum(Quantity)
FOR DocDate IN (
to_date('2009-01-01', 'YYYY-MM-DD') AS Jan09Total,
to_date('2009-02-01', 'YYYY-MM-DD') AS Feb09Total
)
);
As noted by Robin, if your columns vary, then you will have to dynamically generate such a query with the correct columns.