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 Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Distributing Data from Rows Across Columns

Status
Not open for further replies.

raven4

Vendor
Jan 10, 2008
32
US
Here's an example of my data:

ID VALUE
100 A
100 B
101 C
101 D

I want the result to be:

ID VALUE1 VALUE2
100 A B
101 C D

There are always only 2 values for each ID.

I am using SQL 2000 so PIVOT is not an option, besides which this isn't exactly similar to the examples of pivots/crosstabs I've seen in BOL and elsewhere.

Thanks.
 
Code:
Select Id, Min(Value) As Value1, Max(Value) As Value2
From   YourTableNameHere
Group By Id


-George

"The great things about standards is that there are so many to choose from." - Fortune Cookie Wisdom
 
Oh my gosh, how simple! I hate when I over-complicate things.

Thanks a ton.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top