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:
01646011
Views:
34
SELECT AA."Company Code", AA.Name,
             (SELECT Email+';'
                 FROM (SELECT DISTINC CA.Email FROM myTable CA  WHERE CA."Company Code"=AA."Company Code") BA
                FOR XML PATH('')
             ) AS Email
  FROM (SELECT DISTINCT "Company Code", NAME 
                FROM myTable
           ) AA
MartinaJ

>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
"Navision is evil that needs to be erazed... to the ground"

Jabber: gorila@dione.zcu.cz
Jabber? Jabbim
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform