SQL Server Forums
Profile | Register | Active Topics | Members | Search | Forum FAQ
 
Register Now and get your question answered!
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 SQL Server 2005 Forums
 Transact-SQL (2005)
 Horizontal To Vertical Record
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

sanj
Starting Member

22 Posts

Posted - 11/08/2012 :  12:36:28  Show Profile  Reply with Quote
Hi,

I am trying to convert a horizontal recordset to vertical, I've seen some other post an know I need a pivot table but have got confused:

the recordset output looks like:

my query is:

SELECT tbl_reviews.ReviewerID, tbl_reviews.ReviewerStatus, tbl_reviews.ReviewerComments, tbl_Files.Type, tbl_Files.FileName, tbl_Login_1.CompanyName, tbl_Login_1.ContactName, tbl_Files.FileID

FROM tbl_Login AS tbl_Login_1 RIGHT OUTER JOIN
tbl_reviews ON tbl_Login_1.LoginID = tbl_reviews.ReviewerID LEFT OUTER JOIN
tbl_Login INNER JOIN
tbl_Files ON tbl_Login.LoginID = tbl_Files.LoginID ON tbl_reviews.FileID = tbl_Files.FileID
WHERE (tbl_Files.FileID = 37)


The Current Output is

13 A NULL Docs Doc1.pdf ABC username1 37
9 NULL NULL Docs Doc1.pdf DEF username2 37


I am looking at returning the recordset as:

37 Docs Doc1.pdf 13 A Null ABC username1 9 Null Null DEF username2


Any help is appreciated.
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.05 seconds. Powered By: Snitz Forums 2000