简体   繁体   中英

SQL join: Join two tables to get the result from second tables to grep result and

I want to grep the Employee Unique Tax ID from first Tables to second starting like: 在此处输入图片说明

select * from where Employee_ID as 'var1' Join on Employee_Catagory as 'var2' Join On Employee_Pos. as var3 . 

To get the Employee Unique_Tax_ID as $res I want to have it in a Sigle SQL Statement. The var1 -var3 value is not important because that can I change with PHP in that file with functions.

Simple LEFT JOIN should do:

select t1.employee_id,
    t1.employee_category,
    t1.employee_pos,
    t2.unique_tax_id
from table1 t1
left join table2 t2 on t1.system_id = t2.system_id

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM