Answer the question
In order to leave comments, you need to log in
How to fill a table from another by condition?
I have an Employee table:
pos_id is a foreign key to the Position table:
The Employee table has a position field in which the positions of employees are written, all those positions are in the Position table.
How can I query the pos_id so that the pos_id number in the Employee table matches the pos_id number in the Position table, while the position of the Employee table is equal to the pos_name of the Position table?
Answer the question
In order to leave comments, you need to log in
chain the tables by position (inner join) and then you can assign the id from the job directory to the id of the employee directory
update Employee
set pos_id=Position.pos_id -- очевидно что слева обновляемая таблица
from Emploee
inner join Position on Position.pos_name=Employee.position
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question