Pivot Tables in SQL
I was working on SSRS to generate a report for a client. But instead of the conventional way, they'd like what was data in the rows to be displayed as column name. Assuming the problem is same as the following. The inventory system holds a list of products for each client, and tagged by different categories. CREATE TABLE Inventory(ClientId INT, Category NVARCHAR(10), Product NVARCHAR(10)) INSERT INTO Inventory VALUES (1, 'Fruit', 'Banana') INSERT INTO Inventory VALUES (1, 'Fruit', 'Apple') INSERT INTO Inventory VALUES (1, 'Fruit', 'Orange') INSERT INTO Inventory VALUES (1, 'Fruit', 'Kiwi') INSERT INTO Inventory VALUES (1, 'Fruit', 'Pinapple') INSERT INTO Inventory VALUES (1, 'Fruit', 'Mango') INSERT INTO Inventory VALUES (1, 'Fruit', 'Grape') INSERT INTO Inventory VALUES (2, 'Fruit', 'Acerola') INSERT INTO Inventory VALUES (2, 'Fruit'...