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.

 All Forums
 SQL Server 2000 Forums
 Transact-SQL (2000)
 merge several columns and records

Author  Topic 

Nahymt
Starting Member

2 Posts

Posted - 2010-08-30 : 23:45:33
Hi, I'm new here. I need to combine several rows and columns into one row.

vp_assistant_schedule:
AssistantID, DayID, ShiftID

For example I have:

AstA, 1, 1
AstA, 1, 2
AstA, 3, 1

I need to display it as:
AstA, Day 1 7.00-9.00, 9.00-11.00; Day 3 7.00-9.00

or if that's too hard at least
AstA, Day 1 7.00-9.00, Day 1 9.00-11.00, Day 3 7.00-9.00

So far I only have it look as:
AstA, Day 1 7.00-9.00
AstA, Day 1 9.00-11.00
AstA, Day 3 7.00-9.00

How do I combine these based on each AssistantID? And the database is located on the a server where I can't create any proc or table at all. Thanks

Nahymt
Starting Member

2 Posts

Posted - 2010-08-31 : 01:48:57
Already solved it, I imported my query as a new table into my local database and then created a function with coalesce to do it.

Go to Top of Page
   

- Advertisement -