T-SQL has the PIVOT that facilitates the process.
A simple example:
DECLARE @myValues TABLE (Quantity INT, Category VARCHAR(100)) INSERT INTO @myValues (Quantity, Category) VALUES (10, 'Fruits'), (200, 'Vegetables'), (40, 'Meats') SELECT * FROM @myValues SELECT [Fruits], [Vegetables], [Meats] FROM @myValues PIVOT ( MAX(Quantity) FOR Category IN ([Fruits], [Vegetables], [Meats]) ) Piv
No comments:
Post a Comment