Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 Transact-SQL (2000)
 Pivot Tables

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2004-05-07 : 11:20:06
Jennifer writes "I have read the manuals on pivot tables but I just can not get it to work for me. I am trying to do something very simple. I am using SQL Query Analyser 8.

I have created a pivot table:
create table pivot (
STKEY varchar(10),
ENTRY varchar(6)
)

select * from pivot return:
STKEY ENTRY
AARONR 6102
AARONR 6103A
BAKERA 5555

I want to return the above data as follows:
AARONR 6102 6103A
BAKERA 5555

STKEY may have up to 12 ENTRY codes. I want all ENTRY codes to return on the same record for a STKEY.

Has anyone got a suggestion how I can achieve this?"
   

- Advertisement -