如何在MS Access DB中实现VLOOKUP功能?

时间:2017-07-30 04:02:53

标签: sql ms-access

我有一个MS Access DB如下:

Employee_Table:

Employee_ID     Employee_Name
     1              Rachel
     2              Jordan
     3              Chris

Event_Table:

Event_ID     Employee_ID    Employee_Name
    1                           Rachel
    2                           Rachel
    3                           Rachel
    4                           Jordan

如何使用SQL自动填充引用Employee_Table的Event_Table中的Employee_ID列?

期望的输出:

Event_ID     Employee_ID    Employee_Name
    1             1             Rachel
    2             1             Rachel
    3             1             Rachel
    4             2             Jordan

1 个答案:

答案 0 :(得分:0)

如果您想要查询,则只需使用inner join

select et.event_id, e.employee_id, e.employee_name,
from event_table as et join
     employee_table as e
     on et.employee_name = e.employee_name;