Mahesh Barot
Mahesh Barot

Reputation: 7

How to get data from multiple table

i have 3 table i m merge two table by join but cant Merge more then 3 table

multiple time

$query="select * from emp_table INNER JOIN emp_salary on emp_table.emp_id=emp_salary.emp_id";

how to get get three table data in singe table

Upvotes: 0

Views: 31

Answers (1)

Tim Biegeleisen
Tim Biegeleisen

Reputation: 520948

A general pattern you might use here would be something like:

SELECT *
FROM emp_table emp
INNER JOIN emp_salary sal
    ON emp.emp_id = sal.emp_id
INNER JOIN emp_address addr
    ON emp.emp_id = addr.emp_id;

But note that in practice SELECT * should be avoided (I only used it because I don't know in which columns, from which tables, you are interested). Your actual PHP script should only select the columns you really need.

Upvotes: 1

Related Questions