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!

Transpose Rows to Columns? 2

Status
Not open for further replies.

lemkepf

Technical User
Oct 8, 2002
86
0
0
US
Hello SQL Gods again... this is the second post today... let's just say the brain is going with all this nice weather!

Here is the problem... I want to compare 2 products right next to each other on an ASP page. what i would like to do is to convert the rows of each sku into columns. SOOO... instead of this:

ID Sku Name Date
2 414 Stuff 01/04/03
3 453 stuf2 03/04/03

To look like...

ID 2 3
Sku 414 453
Name Stuff stuf2
....
and so on. Soooo anyone know of a quick way to do this via SQL?
Thanks again guys you are a real help!!!
 
If it is an ASP page then I assume your recordset is an ADO recordset. The getrows method of the recordset will return the rows and columns inverted. The index structure is counterintutitive as the fields will be dimension 1 and the rows dimension 2 in the array returned by getrows.
 
This Can be Achieved by Using the Cross-tab Query.
Please refer to Books Online for more details.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top