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)
 another crosstab question....

Author  Topic 

mdelgado
Posting Yak Master

141 Posts

Posted - 2003-11-05 : 10:53:09
Robv mentions in his original article that you can "ORDER BY cross-tabbed columns".

I have the date showing as the column headers, but they are not sorted correctly.

Does anyone know how to do this?

thanks.

jsmith8858
Dr. Cross Join

7423 Posts

Posted - 2003-11-05 : 14:06:55
Can I ask what you are doing with this data after the cross tab occurs? how are you presenting it?

- Jeff
Go to Top of Page

robvolk
Most Valuable Yak

15732 Posts

Posted - 2003-11-05 : 19:00:40
Do you mean setting a particular order for the column headings, OR ordering the data BY one of the pivoted columns? They're two different things. For the 2nd item, simply include an ORDER BY clause in your @select parameter, and use the name of the pivoted column (assuming you know what that value would be)

There is a modification to the original that will present the pivoted columns in a specified order. You can find it in the Comments section of the cross tab article:

http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=6216
Go to Top of Page

mdelgado
Posting Yak Master

141 Posts

Posted - 2003-11-05 : 21:10:54
setting a particular order for the column headings.

Thanks Rob. The link you sent will help me.

This is a great tool and it has helped me tremendously. Many Thanks.
Go to Top of Page
   

- Advertisement -