![]() | |
![]() |
| | Thread Tools | Display Modes |
#1
| |||
| |||
|
|
From my query I want to show in excel xx (AT) xx (DOT) com - xx - Product1, Product2 |
#2
| |||
| |||
|
|
Hi I need to produce an excel output from SQL that shows email - company name - producttype1, producttype2 (where the - denotes a change in column) basically i have a table the first line is the fields and the second and third are the entries email - companyname - producttype x... (AT) xx (DOT) com - xx - Product1 x... (AT) xx (DOT) com - xx - Product2 From my query I want to show in excel x... (AT) xx (DOT) com - xx - Product1, Product2 ie I only want 1 row for the email, but want to show the 2 products they have listed for them. This is a simplistic version of what I want as there are actually other fields in the table which I want to display in exactly the same way, only 1 line per contact. Can anyone help? Thanks Archana |
#3
| |||
| |||
|
|
CREATE FUNCTION dbo.ufn_concatProducts( @email varchar(255) , @company varchar(255)) RETURNS varchar(255) AS BEGIN DECLARE @productList varchar(8000) SELECT @productList = coalesce(@productList + ',', '') + product FROM tbl WHERE email = @email AND company = @company RETURN(@productList) END |
![]() |
| Thread Tools | |
| Display Modes | |
| |