所以我有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)
我认为您只是缺少一个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