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)
 Concatenating within SQL Command

Author  Topic 

bi89405
Starting Member

35 Posts

Posted - 2009-12-23 : 14:38:24
Hello,

I'd like to ask you guys for assistance on how I can do the following in SQL:

The data looks as follows:


check# check_line desc_line des
12233 100 1 Joe Smith Trip to Vegas
12233 200 1 Cab pickup @ 5:45pm to Palms wait
12233 200 2 time 12 minutes.
12233 300 1 Meals
12233 400 1 Dinner w/ Jane Doe at Planet
12233 400 2 Hollywood.


How can I get the result to look like this in SQL?:



check# check_line des
12233 100 Joe Smith Trip to Vegas
12233 200 Cab pickup @ 5:45pm to Palms wait time 12 minutes.
12233 300 Meals
12233 400 Dinner w/ Jane Doe at Planet Hollywood.


Many thanks in advance,
Regards,
Zack H.

djj55
Constraint Violating Yak Guru

352 Posts

Posted - 2009-12-23 : 15:10:13
You might try something like: (notice t-sql untested)

select a.check#, a.check_line, a.des + b.des
from mytable A
left join (select check#, check_line, des from mytable where desc_line = 2) as b
on a.check# = B.check# and a.check_line = b.check_line
where a.desc_line = 1
Go to Top of Page

vijayisonly
Master Smack Fu Yak Hacker

1836 Posts

Posted - 2009-12-23 : 15:14:11
Go through this link. It has concatenation approached for both SQL server 2000 and 2005.

http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=81254
Go to Top of Page
   

- Advertisement -