MySQL Basic about relationship -
I doubt how to treat the following:
I have a system where the user Belongs to a company, and this user has his own customer.
How is the correct way to get the list of all company customers and follow the username?
In the client table
Tkz Roberto
Tables Relationships:
Client (FK_companyID, FK_UserID) "If you have multiple companies, use FK_companyId"
User (FK_companyId).
Company (no foreign keys for customer or user).
If there is only one company in the system, you do not have to include it in the relationship:
Open the client from the client where userId = userSessionId;
If you have multiple companies:
Quit leaving a client's client, client.clientInfo, client.companyId, company.companyInfo (client.companyId = company.Id) Leave the customer at, where userId = userSessionId;
Note: The left join is used to obtain "company information", but if all the user clients connected to that particular company will be recovered.
Finally: If a client information can be managed by the mute user, then you do not have to add both organizations together by adding them together.
BTW: Your english is awesome!
Comments
Post a Comment