Please find attach an image, I need a general SQL query (for more than two records) I mean not hard coded. Thanks
Asked
Active
Viewed 72 times
-3
-
am using Microsoft sql server Managment studio – khan Mar 24 '16 at 05:53
-
1This could help you http://stackoverflow.com/questions/15745042/efficiently-convert-rows-to-columns-in-sql-server – Sanu Antony Mar 24 '16 at 06:08
-
i have tried already but not working, can you plz write down exact query for me?? please – khan Mar 24 '16 at 06:13
-
Welcome to stackoverflow. Please read [ask]. – Zohar Peled Mar 24 '16 at 08:08
-
Ask how to do it, not do it for me... – NewGuy Mar 24 '16 at 12:38
-
You're creating several accounts to post the [same question](http://stackoverflow.com/questions/36195481/converting-rows-into-columns-in-sql-server-2008-without-using-aggregate-functio)? – James Z Mar 24 '16 at 18:45
-
Possible duplicate of [SQL Server dynamic PIVOT query?](https://stackoverflow.com/questions/10404348/sql-server-dynamic-pivot-query) – Daniel Bürckner Jul 04 '18 at 06:30
1 Answers
0
--You use sql Pivot to do it. See code bellow
SELECT * FROM ( SELECT ItemCode, ItemName,FrnName,ItmsGrrpCod FROM Table_Name ) AS abc
PIVOT ( COUNT(ItemCode) FOR [ItemName] IN ([ACT00054],[ACT00056],[ALF00001],[FGC00001]) ) AS PV1

JonWay
- 1,585
- 17
- 37