Inner join with mysql does not works

advertisements

Hey guys am new to mysql development and am trying to inner join my both tables ..My code

SELECT Customers.name, oop.id
FROM Customers(SELECT name,id FROM Orders) AS oop
INNER JOIN oop
ON Customers.name=oop.id
ORDER BY Customers.name;

When i tried this code it shows me error i know this can be easily done with other method but i have seen this method on a website so i tried..Am i doing any error in my code.

Hope you guys can help me out ..Any help would be appreciated ..Thanx


You are writing a wrong syntax. it would be somthing like this:-

SELECT Customers.name, oop.id
FROM Customers
INNER JOIN (SELECT name,id FROM Orders) AS oop
ON Customers.name=oop.id
ORDER BY Customers.name;