Amr Hassan
Amr Hassan

Reputation: 21

Transferring right join into subquery

I have the following query:

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

How can I get the same retreived data using subquery?

Upvotes: 0

Views: 66

Answers (1)

Nguyễn Hải Triều
Nguyễn Hải Triều

Reputation: 1464

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

Upvotes: 2

Related Questions