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

Merging Two fields into one

Status
Not open for further replies.

Jenns

Programmer
Nov 1, 2000
36
US
Hello,
I have multiple SQL tables which contain different types of comments for companies. I want to write a query which pulls them all together for a specific company so you can easily view all the comments for that company. However I just want to see all the comments in one field.

So instead of:
CompanyName, comment1, comment2, comment3

I want to display in an HTML table a list of all the comments:
CompanyName and Comment

The only way I know how to do this is using a stored proc and dumping all the comments for a specific company into a temporary table.

Is there an easier or better way?

I've also tried:
Select Table1.Companyname, Table1.comments as Comments, Table2.comments as Comments
From Table1 inner join Table2 on Table1.companyid = Table2.companyid

But that still returns:
Companyname, Comments, Comments


Thanks!
Jenn
 
Try:
Code:
Select  Table1.Companyname, Table1.comments + Table2.comments as Comments 
From Table1 inner join Table2 on Table1.companyid = Table2.companyid

Questions about posting. See faq183-874
 
Perfect! Thanks a lot!

Thanks!
Jenn
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top