makeitwork09
Technical User
I want one column and one row that acts as a concatenated list, separated with a carriage return.
I have a table with the fields code, loancomment, commentdate, and note1.
Note1 is a datatype of text.
The data in the table, if I select the note1 records returns 3 rows of data. I want those three rows to be one row with all three rows in that one row.
Therefore, a straight query for note1 has a result set of:
(1) $30,525,000 mortgage loan with an initial funding of $28,925,000 and a commitment to fund up to $1,600,000 for tenant improvement costs and leasing commissions.
(1) $30,525,000 mortgage loan with an initial funding of $28,925,000 and a commitment to fund up to $1,600,000 for leasing commissions.
(2) 21,775,000 mortgage loan with a commitment to fund up to $2,000,000 for tenant improvements.
3 row(s) affected
I want to have
(1) $30,525,000 mortgage loan with an initial funding of $28,925,000 and a commitment to fund up to $1,600,000 for tenant improvement costs and leasing commissions.
(1) $30,525,000 mortgage loan with an initial funding of $28,925,000 and a commitment to fund up to $1,600,000 for leasing commissions.
(2) 21,775,000 mortgage loan with a commitment to fund up to $2,000,000 for tenant improvements.
1 row(s) affected
I have all of the following, but the last row is not returning at all the text and only part of the second note is returning.
The results I am getting for the one row using all of the above is:
(1) $30,525,000 mortgage loan with an initial funding of $28,925,000 and a commitment to fund up to $1,600,000 for tenant improvement costs and leasing commissions.
(1) $30,525,000 mortgage loan with an initial funding of $28,925,000 and a commitment to fu
(1 row(s) affected)
I have a table with the fields code, loancomment, commentdate, and note1.
Note1 is a datatype of text.
The data in the table, if I select the note1 records returns 3 rows of data. I want those three rows to be one row with all three rows in that one row.
Therefore, a straight query for note1 has a result set of:
(1) $30,525,000 mortgage loan with an initial funding of $28,925,000 and a commitment to fund up to $1,600,000 for tenant improvement costs and leasing commissions.
(1) $30,525,000 mortgage loan with an initial funding of $28,925,000 and a commitment to fund up to $1,600,000 for leasing commissions.
(2) 21,775,000 mortgage loan with a commitment to fund up to $2,000,000 for tenant improvements.
3 row(s) affected
I want to have
(1) $30,525,000 mortgage loan with an initial funding of $28,925,000 and a commitment to fund up to $1,600,000 for tenant improvement costs and leasing commissions.
(1) $30,525,000 mortgage loan with an initial funding of $28,925,000 and a commitment to fund up to $1,600,000 for leasing commissions.
(2) 21,775,000 mortgage loan with a commitment to fund up to $2,000,000 for tenant improvements.
1 row(s) affected
I have all of the following, but the last row is not returning at all the text and only part of the second note is returning.
Code:
select
(
select cast(om.note1 as varchar(max)) + char(10)
from loancomm as om
where om.commtopic = 'ic_footnot'
for xml path (''),type
)
Code:
select
(
stuff((select cast(om.note1 as varchar(max)) + char(10)
from loancomm as om
where om.commtopic = 'ic_footnot'
for xml path (''),type).value('.', 'varchar(max)'),1,0,'')
)
Code:
select
(
select cast(om.note1 as varchar(max)) + char(10)
from loancomm as om
where om.commtopic = 'ic_footnot'
for xml path (''),type).value('substring((./text())[1], 1)', 'varchar(max)')
The results I am getting for the one row using all of the above is:
(1) $30,525,000 mortgage loan with an initial funding of $28,925,000 and a commitment to fund up to $1,600,000 for tenant improvement costs and leasing commissions.
(1) $30,525,000 mortgage loan with an initial funding of $28,925,000 and a commitment to fu
(1 row(s) affected)