Home > OS >  I want to convert exist clause into In clause of the following query
I want to convert exist clause into In clause of the following query

Time:10-17

SELECT SupplierName
FROM Suppliers
WHERE EXISTS (SELECT ProductName FROM Products 
              WHERE Products.SupplierID = Suppliers.supplierID AND Price < 20);

I want to convert the existing clause into an IN clause of the query.

CodePudding user response:

Here you go:

SELECT SupplierName
FROM Suppliers
WHERE Suppliers.SupplierID IN (
    SELECT Products.SupplierID
    FROM Products 
    WHERE Price < 20
)
  • Related