Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
MS-SQL Query Help
Message
 
 
To
24/12/2016 03:53:51
Mazahir Naya
Pixel Digital Systems LLC
United Arab Emirates
General information
Forum:
Microsoft SQL Server
Category:
SQL syntax
Environment versions
SQL Server:
SQL Server 2008 R2
OS:
Windows 7
Miscellaneous
Thread ID:
01646004
Message ID:
01646026
Views:
44
Minor fix in Martina's query:
SELECT AA."Company Code", AA.Name,
             (SELECT BA.Email + '; '
                 FROM myTable BA
                 WHERE BA.[Company Code] = AA.[Company Code] and BA.[Name] = AA.[Name]
                FOR XML PATH('')
             ) AS Email
  FROM (SELECT DISTINCT "Company Code", NAME 
                FROM myTable
           ) AA
>hello Martina
>
>so far query working fine but duplicate record is still in query output.
>
>Query Out Put:
>Company_Code Name Email
>001 Chung, Kristina abc@xyz.com;asdfg@gmail.com;
>001 Lawrence, Neal abc@xyz.com;asdfg@gmail.com;
>
>002 Gallagher, Marian maza@gmail.com;mazahir.naya@gmail.com;
>002 Steele, Alex maza@gmail.com;mazahir.naya@gmail.com;
>
>003 Hawkins, Stephanie rohit@gmail.com;mprint@pixel.com;
>003 Middleton, Tim rohit@gmail.com;mprint@pixel.com;
>
>004 Frame, Mark shanty@kuwait.com;
>
>Thank You.
>Best Regards,
>Mazahir
If it's not broken, fix it until it is.


My Blog
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform