Solved

Displaying column data

Posted on 2009-04-11
2
202 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

In SQL Server, when rows are selected from a table, does it retrieve data in the order in which it is inserted?  Many believe this is the case. Let us try to examine for ourselves with an example. To get started, use the following script, wh…
This article explains how to reset the password of the sa account on a Microsoft SQL Server.  The steps in this article work in SQL 2005, 2008, 2008 R2, 2012, 2014 and 2016.
Internet Business Fax to Email Made Easy - With  eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, f…
Video by: Mark
This lesson goes over how to construct ordered and unordered lists and how to create hyperlinks.

896 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

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now