MySQL Forums
Forum List  »  Newbie

access to other columns though other table's foreign key
Posted by: Jay Lee
Date: June 16, 2022 03:42PM

I have employee table and project table

employee has [ID] and [role]

project has employee's [ID] as a foreign key
I want to restrict mySQL behaviour so that
only accepts employee's [ID] where that employee's [role] = "pm"
how would I do that?

I would imagine it would look simillar like this:

FOREIGN KEY(pmNo) REFERENCES employee(empNo) WHERE(employee.role == "PM" )

Thank you for help in advance!

Options: ReplyQuote


Subject
Written By
Posted
access to other columns though other table's foreign key
June 16, 2022 03:42PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.