[SQL Server] Split data from one column into multiple colums |
Split data from one column into multiple colums Posted: 17 Aug 2013 03:24 AM PDT Table is called drugs and is laid out like so:[code="plain"]name dosage packsizeaspirin 75mg 10aspirin 75mg 20aspirin 150mg 10aspirin 150mg 20aspirin 300mg 10aspirin 300mg 20aspirin 300mg 30[/code]What I need to do is show this:[code="plain"]Name dosage packsize10 packsize20 packsize30aspirin 75mg x o oaspirin 75mg o x oaspirin 150mg x o oaspirin 150mg o x oaspirin 300mg x o oaspirin 300mg o x oaspirin 300mg o o x [/code]where x = positive and o=negative resultI'm pretty sure that I'm going to have to create a new table, but I can't for the life of me get the name, dosage and packsize to all be on the same row.Any and all help is very much appreciated. |
You are subscribed to email updates from SQLServerCentral / SQL Server 2008 / SQL Server Newbies To stop receiving these emails, you may unsubscribe now. | Email delivery powered by Google |
Google Inc., 20 West Kinzie, Chicago IL USA 60610 |
No comments:
Post a Comment