MySQL Forums
Forum List  »  Newbie

Re: Inner Join of 3 tables
Posted by: douglas wilson
Date: August 21, 2014 01:24AM

Inner join can use to joining the tables.you can join many table.This is the syntax of the inner join.Do not use union.Just try this queries.

SELECT column_list FROM t1 INNER JOIN t2 ON join_condition1 INNER JOIN t3 ON join_condition2
...
WHERE where_conditions;

SELECT t1.col, t3.col FROM table1 join table2 ON table1.primarykey = table2.foreignkey
join table3 ON table2.primarykey = table3.foreignkey

and this is the eg:

mysql> SELECT emp_name, dept_name FROM Employee e JOIN Register r ON e.emp_id=r.emp_id JOIN Department d ON r.dept_id=d.dept_id;

Options: ReplyQuote


Subject
Written By
Posted
August 20, 2014 03:59PM
August 20, 2014 09:41PM
August 21, 2014 08:11AM
August 21, 2014 11:52AM
Re: Inner Join of 3 tables
August 21, 2014 01:24AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.