Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Pivot query

Status
Not open for further replies.
Mar 20, 2003
103
0
0
AU
I got a table name RESULTS. eg:

ID|QUESTION|ANSWER
------------------
1 | Q1 | a
1 | Q1 | b
1 | Q2 | c
2 | Q1 | a
2 | Q2 | c
2 | Q3 | d
2 | Q3 | e

I need to display it the following way:

ID|Q1|Q2|Q3
-----------
1 |a |c |
|a |
2 |a |c |d
|e

Can someone please show me a script to do the following? Thanks
 
A long time ago I was working through generatng dynamic crosstab queries in SQL. Here's the help I got: thread183-451930

Google crosstab SQL, xtab, pivot... You'll find tutorials of varying difficulty.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top