将右连接转移到子查询中

时间:2015-10-14 06:36:52

标签: sql-server

我有以下查询:

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

如何使用子查询获取相同的检索数据?

1 个答案:

答案 0 :(得分: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