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.
| Author |
Topic |
|
nitinag
Starting Member
20 Posts |
Posted - 2004-08-07 : 20:00:06
|
| I have a Select statement that returns me few rows(unknown number of rows) in two columns , is there a way that I can tramsform this into Horinzontal mode for example Current Results(Remember the actual number of rows returned is unknown) Account 5634023CostCenter 233106021IONumber 562Results I would likeAccount CostCenter IONumber563.. 233.. 562.. |
|
|
kselvia
Aged Yak Warrior
526 Posts |
Posted - 2004-08-08 : 03:57:14
|
| Search here for crosstab or see this article http://www.sqlteam.com/item.asp?ItemID=2955 and comments for more info.--Ken"Knowledge is a process of piling up facts; wisdom lies in their simplification." |
 |
|
|
nitinag
Starting Member
20 Posts |
Posted - 2004-08-08 : 13:18:52
|
| Problem is that it returns unknown number of rows(i.e. unknown number of columns for final result) . may be I am missing something but I cannot see crossTab being applied here. Here's the actual query select field_name,case field_type_id when 3 then (Select dd_display from web_procure_custom_field_dropdown_details where field_id=a.field_id and dd_value=custom_value) else custom_value Endas 'Value'from web_procure_custom_field a,web_requisition_custom_field_values bwhere a.field_id=b.custom_field_id and active=1and requisition_id=@ReqId thanks |
 |
|
|
|
|
|