October 19, 2009 at 1:54 pm
I have a table called Miscextra that is setup as shown below:
ID (primary key)
Number (secondary key)
Title
Thedata
There are multiple rows for each Number in this table; one for each Title to be specific. There are various different Title's in this table which are repeated for certain groupings of Number's. For example, for 10 Numbers, there are different 5 Title's for each number. The titles are as follows:
state
dob
name
phone
bank
If I do a select * from miscextra where number = '1234' I'll get 5 rows returned. I'd like to get a single row returned containing all of the data elements for that record. I don't have to have the Title row returned; I'm more concerned about the "Thedata" records.
Any help would be greatly appreciated.
Thanks!
October 19, 2009 at 2:42 pm
Use Pivot table Functionality
Blog -- LearnSQLWithBru
Join on Facebook Page Facebook.comLearnSQLWithBru
Twitter -- BruMedishetty
October 19, 2009 at 2:46 pm
Bru,
I'm not familiar with the Pivot syntax. Could you provide a sample for me?
Thanks!
October 19, 2009 at 6:23 pm
I think you better send the table create Scripts for the Tables that you are talking,
which would be more easier to understand.
Blog -- LearnSQLWithBru
Join on Facebook Page Facebook.comLearnSQLWithBru
Twitter -- BruMedishetty
October 19, 2009 at 10:46 pm
mspiegel (10/19/2009)
Bru,I'm not familiar with the Pivot syntax. Could you provide a sample for me?
Thanks!
Yep... same priciple as in the following...
http://www.sqlservercentral.com/articles/T-SQL/63681/
--Jeff Moden
Change is inevitable... Change for the better is not.
Viewing 5 posts - 1 through 4 (of 4 total)
You must be logged in to reply to this topic. Login to reply