How to use Join query to get data from two or more table of database ?

 

I want to get combine data from two table by using only one sql query.


Answer
 

SELECT table1.* table2.* FROM table1 INNER JOIN table2 ON table1.foreign_key=table2.primary_key;
Example:

SELECT Orders.OrderID, Customers.CustomerName, Orders.OrderDate
FROM Orders
INNER JOIN Customers ON Orders.CustomerID=Customers.CustomerID;

Note:- Use column name instead of * to get only some selected column