从多列中的一列中选择多个值 [英] Selecting multiple value from one column in multiple columns

查看:58
本文介绍了从多列中的一列中选择多个值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

亲爱的,



我有2张这样的桌子:



产品:

ID ----费用

=======

1 ----- 5.00

2 ----- 3.00



ProductsLanguage:

ProductID ---- LanguageID ----说明

=========================

1 -------------- 1 ---------------百事可乐

1 -------------- 2 ---------- -----بيبسى

2 -------------- 1 ---------------可口可乐

2 -------------- 2 ---------------كوكاكولا



现在我想要输出如下:



输出:

ProductID ---成本--- EnglishDescription --- ArabicDescription

=====================================

1 ------------ 5.00 ----百事可乐-----------------بيبسى

2-- ---------- 3.00 ---- CocaCola -------------كوكاكولا





请告诉我相应的查询。



谢谢

:)

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
:)

推荐答案

嗨迈克尔,



你可以使用PIVOT表来获得你想要的输出。



请参考以下链接:



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



如果您对此有任何疑问或疑问,请与我们联系。



谢谢
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


这篇关于从多列中的一列中选择多个值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆