所以我有3张桌子。 第一个表有2个外键,而外键中有另外一个。
(抱歉英语不好)
示例:
First table: table1
Foreign keys:
ID from table1 (I will get the employee name)
ID from table2 (I will get the job name)
答案 0 :(得分:0)
我认为你错过了JOINs
:
SELECT
tbl_job_site.JOB_NAME,
tbl_employee.EMP_CODIGO,
tbl_company.COM_CODIGO
FROM tbl_job_running jr
INNER JOIN tbl_employee e ON jr.EMP_CODIGO = e.EMP_CODIGO
INNER JOIN tbl_job_site js ON jr.JOB_CODIGO = js.JOB_CODIGO
INNER JOIN tbl_company c ON c.COM_CODIGO = e.COM_CODIGO