Join 3 Tables

From rbachwiki
Revision as of 19:58, 1 November 2017 by Bacchas (talk | contribs)
Jump to navigation Jump to search
=== Join 3 Tables ===

SELECT A.sales_date, A.order_id, A.product_id, B.product_name, C.job_title

FROM sales A INNER JOIN product B
ON A.product_id = B.product_id 
LEFT OUTER JOIN salesperson C
ON A.salesperson_id = C.salesperson_id;

Join 4 Tables

SELECT A.sales_date, A.order_id,  A.product_id, B.product_name, C.job_title, D.first_name, D.last_name
FROM sales A INNER JOIN product B
ON A.product_id = B.product_id 
LEFT OUTER JOIN salesperson C
ON A.salesperson_id = C.salesperson_id
INNER JOIN customer D
ON A.customer_id = D.customer_id;


Back To Top- Home - Category