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
 General SQL Server Forums
 New to SQL Server Programming
 Concatenate Rows

Author  Topic 

spitfire122
Starting Member

11 Posts

Posted - 2011-07-06 : 09:30:21

I'm a total newb in SQL so i have no idea how to concatenate, even if i was given the code, i wouldnt know where to insert the syntax correctly.

This query is going to return duplicate records for a unique ID i use (ll.loan_number)... because there are multiple financial packages for each loan number. how do i concatenate this code so it shows the ll.loan_number once, but will show the d.document_value all in a single row? separated by +', '+

Use DocNet
go

select
ll.loan_number
,d.document_id
,dd.document_name
,d.document_value
,d.create_date
from
[image].link_image_document d with(nolock)

inner join loan.loans ll on
ll.loan_id = d.loan_id

inner join document.documents dd on
dd.document_id = d.document_id
where
document_name = 'Financial Package'
and d.create_date > '6/16/11'

nigelrivett
Master Smack Fu Yak Hacker

3385 Posts

Posted - 2011-07-06 : 09:36:24
see
http://www.nigelrivett.net/SQLTsql/CSVStringSQL.html

==========================================
Cursors are useful if you don't know sql.
SSIS can be used in a similar way.
Beer is not cold and it isn't fizzy.
Go to Top of Page
   

- Advertisement -