Search Postgresql Archives

How do I make sure that an employee and supervisor belong to the same company?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I have an employees table and one column in the employees table is
"supervisor_id" which is an FK to the id column.  

I have employees from numerous companies all in the same table.  I have
a column called company_id that indicates the company.

I want to make sure that an employee chooses a supervisor from the same
company.  I have a column called company_ID.  How do I make sure that
the employee company ID matches the supervisor's company ID?

Do I need to use a trigger or is there a way I can do this with foreign
keys?

TIA

Matt



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux