2015-10-14 59 views
0

我有以下查询:Transfering右连接到子查询

select 
    name, description 
from tblproducts 
right join tblproductssales 
    on tblproducts.ID = tblproductssales.Product_ID 

我怎样才能使用子查询相同retreived数据?

+2

使用JOINS有什么问题? –

+2

你想在这里实现什么? –

+1

'select name,description from tblproducts where ID In(select tblproductssales中的Product_ID)' –

回答

2
SELECT 
    (SELECT name FROM tblproducts WHERE ID = A.ProductID) AS name, 
    (SELECT description FROM tblproducts WHERE ID = A.ProductID) AS description 
FROM tblproductssales A 
+0

非常感谢你http://stackoverflow.com/users/2254931/nguy%e1%bb%85n-h%e1%ba%a3i-tri%e1%bb%81u)它工作,谢谢你的反馈 –

+0

哦,没问题:) –

+0

如果需要任何帮助,我可以谈谈您的电子邮件或任何联系信息。 –