Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
MS-SQL Query Help
Message
 
To
24/12/2016 02:57:28
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:
01646005
Views:
45
Hi Mazahir,
SELECT AA."Company Code", AA.Name,
             (SELECT BA.Email+';'
                 FROM myTable BA
                 WHERE BA."Company Code"=AA."Company Code"
                FOR XML PATH('')
             ) AS Email
  FROM (SELECT DISTINCT "Company Code", NAME 
                FROM myTable
           ) AA
MartinaJ

>Hello universal Team
>i am not much advance in writing MS-SQL Query help me to get following output from the table.
>
>i have following information in my Table
>
>Company Code| Name | Email
>001 | ABC | ABC@123.com
>001 | ABC | EFG@123.com
>001 | ABC | EFG@123.com
>002 | AAABBBCCC | maza@gmail.com
>002 | AAABBBCCC | Maza.Naya@gmai.com
>
>Query Out Put Need:
>
>Company Code | Name | Email
>001 | ABC | ABC@123.com; EFG@123.com; EFG@123.com
>002 | AAABBBCCC | maza@gmail.com;Maza.Naya@gmai.com
>
>Thanks in Advance.
>Best Regards,
>Mazahir Naya
"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