2022-02-15

In MySQL, can I have two fields joined to the same table?

I am working with a MySQL backend, and a LibreOffice Base frontend. I have a table that lists personnel with a primary key id. I also have a workorders table that has an "entered by" field and a "reviewed by" field, both of which need to store the id of the personnel. Is it okay to have two foreign keys in one table pointing to the same table's primary key? If I do, is it possible to construct a query that will return the personnel's name corresponding to the id in each field? If it is, how is it done?

The Impaler gave a good answer below that I thought was the solution. Infortunately, I only get two results from it. Initially, I thought it was because I only had two workorders with a non-null "reviewed by" field. But now I find that it doesn't matter how many workorders I fill that in for, I only get two results.



from Recent Questions - Stack Overflow https://ift.tt/f5zEh9l
https://ift.tt/XonDdbU

No comments:

Post a Comment