----------------------------------------------------------- New Message on BDOTNET
----------------------------------------------------------- From: _SQL_Vinod_ Message 2 in Discussion Check out these articles and links for transposing columns to rows: http://www.umachandar.com/technical/SQL6x70Scripts/Main25.htm http://sqlteam.com/item.asp?ItemID=256 You can also use logics as described below : Method 1: Select a.ID, (Select Sum(b.qty) from vin_temp b where a.ID = b.ID and cat= 'A') [A], (Select Sum(b.qty) from vin_temp b where a.ID = b.ID and cat = 'B') [B], (Select Sum(b.qty) from vin_temp b where a.ID = b.ID and cat = 'C') [C] >From Vin_temp a Group by a.ID GO Method 2: Select id, Sum(Case When cat='A' Then qty Else 0 End) [A], Sum(Case When cat='B' Then qty Else 0 End) [B], Sum(Case When cat='C' Then qty Else 0 End) [C] from vin_temp Group By ID GO HTH, Vinod Kumar MVP - SQL Server www.ExtremeExperts.com ----------------------------------------------------------- To stop getting this e-mail, or change how often it arrives, go to your E-mail Settings. http://groups.msn.com/bdotnet/_emailsettings.msnw Need help? If you've forgotten your password, please go to Passport Member Services. http://groups.msn.com/_passportredir.msnw?ppmprop=help For other questions or feedback, go to our Contact Us page. http://groups.msn.com/contact If you do not want to receive future e-mail from this MSN group, or if you received this message by mistake, please click the "Remove" link below. On the pre-addressed e-mail message that opens, simply click "Send". Your e-mail address will be deleted from this group's mailing list. mailto:[EMAIL PROTECTED]
