I've got a table known as
Request and data is going to be joined by two kinds of customers (Company staff and people). Initially I'd a column known as
createdby. But, employees and also the people table primary secrets are integers with identity. And so i needed to change it out because there might be an ID that matches both organizations.
I Quickly have produced two posts within the the request table
ByMemberID. I question whether it's the proper way.
Because of the constraints from the existing tables, your approach sounds reasonable, and means that you'll have the ability to create foreign key constraints in the Request table towards the Staff and Member tables. It wouldn't happen to be easy to create any foreign key constraints together with your previous approach (just one CreatedBy area).
When the chance to refactor the present design can be obtained, consider dealing with Staff and People as subclasses of the identical abstract type (e.g. "User"), using among the designs for mapping inheritance to relational tables referred to here.
The way in which factor are positioned up for you personally ok now what you probably did by creating the 2 posts may be the solution.
But, it's a bad one. Essentially you need to have only one
Users table with a few method to differ the consumer types just like a separate table(Roles, UserType etc). You would then have the ability to possess a foreign type in your
Request table which will reference the consumer that produced the first request.