Click here to Skip to main content
14,732,828 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
Dears,

I was having 2 tables like this:

Products:
ID----Cost
=======
1-----5.00
2-----3.00

ProductsLanguage:
ProductID----LanguageID----Description
=========================
1--------------1---------------Pepsi
1--------------2---------------بيبسى
2--------------1---------------CocaCola
2--------------2---------------كوكاكولا

Now I want the output as follows:

Output:
ProductID---Cost---EnglishDescription---ArabicDescription
=====================================
1------------5.00----Pepsi-----------------بيبسى
2------------3.00----CocaCola-------------كوكاكولا


Please tell me the appropriate query for doing so.

Thank you
:)
Posted
Comments
Herman<T>.Instance 21-Jul-15 6:33am
   
You need PIVOT. Example see here
Michael Waguih 21-Jul-15 11:04am
   
I need only a text preview not to do sum()

1 solution

Hi Michael,

You can use PIVOT table to get the output that you want.

Please refer below link:

http://blog.sqlauthority.com/2008/06/07/sql-server-pivot-and-unpivot-table-examples/[^]

Please let me know if you have any concern or query on this.

Thanks
   
Comments
Michael Waguih 22-Jul-15 5:02am
   
I need only a text preview not to do sum()

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900