Solved

Displaying column data

Posted on 2009-04-11
2
210 Views
Last Modified: 2012-05-06
I have a stored proc that brings back data like this:
Id, Name, Code, Quantity
1    x          c1        2
2    y         c2         5
3    z          c1        10

I want to have it like this: basically, i want to have "Code" as the column header with "quantity" under it. I dont want to have a olumn for code and a column for corresponding quantity. Doable??

id, Name, c1,  c2,
1   x         2      0
2   y         0      5
3  z          10    0
0
Comment
Question by:Camillia
2 Comments
 
LVL 5

Accepted Solution

by:
QuintainT earned 500 total points
ID: 24124665
This can probably be done using a PIVOT query. See http://www.mssqltips.com/tip.asp?tip=1019 
This requires you to have a fixed, known number of codes to work though. Is this possible?
0
 
LVL 7

Author Comment

by:Camillia
ID: 24125320
let me look, will post back.
0

Featured Post

Efficient way to get backups off site to Azure

This user guide provides instructions on how to deploy and configure both a StoneFly Scale Out NAS Enterprise Cloud Drive virtual machine and Veeam Cloud Connect in the Microsoft Azure Cloud.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

So every once in a while at work I am asked to export data from one table and insert it into another on a different server.  I hate doing this.  There's so many different tables and data types.  Some column data needs quoted and some doesn't.  What …
Data architecture is an important aspect in Software as a Service (SaaS) delivery model. This article is a study on the database of a single-tenant application that could be extended to support multiple tenants. The application is web-based develope…
Microsoft Active Directory, the widely used IT infrastructure, is known for its high risk of credential theft. The best way to test your Active Directory’s vulnerabilities to pass-the-ticket, pass-the-hash, privilege escalation, and malware attacks …
Email security requires an ever evolving service that stays up to date with counter-evolving threats. The Email Laundry perform Research and Development to ensure their email security service evolves faster than cyber criminals. We apply our Threat…

770 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question