I've got a convoluted Select statement gathering lots of info from a variety of tables.
Abbreviated, I've written something like this:
Select master_customer_id, name, title, company, user
FROM cus_table
WHERE name LIKE 'A%'
On a separate piece of code, I'm using this nice little snippet to turn query results from a separate table directly to a list.
DECLARE @List varchar(2000)
SET @List = ''
SELECT @List = @List + Cast(demo_sub As varchar(20)) + ', '
FROM User_demo
WHERE (master_customer_id = xxxxxxx) AND (demo_code = 'contracts')
SET @List = SUBSTRING(@List, 1, Len(@List) - 1)
SELECT @List As 'List'
Is there a way to push this list into a new column in my original Select sql statement? To somehow combine the two?
I searched this forum and the Internet and can't find any info on combining these two processes.
Thanks.
Abbreviated, I've written something like this:
Select master_customer_id, name, title, company, user
FROM cus_table
WHERE name LIKE 'A%'
On a separate piece of code, I'm using this nice little snippet to turn query results from a separate table directly to a list.
DECLARE @List varchar(2000)
SET @List = ''
SELECT @List = @List + Cast(demo_sub As varchar(20)) + ', '
FROM User_demo
WHERE (master_customer_id = xxxxxxx) AND (demo_code = 'contracts')
SET @List = SUBSTRING(@List, 1, Len(@List) - 1)
SELECT @List As 'List'
Is there a way to push this list into a new column in my original Select sql statement? To somehow combine the two?
I searched this forum and the Internet and can't find any info on combining these two processes.
Thanks.