0

I have a problem, but I can't find any solution to it.

I have users grouped in groups, one user can't be in more than one group (so, one group many users. No problems here). One user of one group must be the owner of that group, again, it can't be the owner of two or more groups (since one user can't be in more than one group). And, at last, the owners of groups must be a child of a parent Customers table.

To clarify, one user can be in a group. One group can have many users, the owners of the groups are users and are Customers too. One group can have only one owner.

I need a design to support this, I have tried a lot of ERD's but I can't find the solution.

Brent Hronik
  • 2,357
  • 1
  • 27
  • 43
  • Draw out an ERD that you have tried, and post it here. – Darius X. Feb 26 '13 at 21:00
  • I recently try this ERD http://tinyurl.com/bvt8twf, i think that this can resolve my problem. In this, OWNERS its an specialization of CUSTOMERS and has a one to one relationship with GROUPS and USERS. – Rafael E. Ferrero Feb 28 '13 at 11:30

1 Answers1

0

Customer
ID, Name

User ID, Name, GroupID, IsOwner (boolean), CustomerID

Group ID, Name, Owner (UserID)

Apologies If I'm missing the point of your question!

kbbucks
  • 108
  • 8
  • You aren't missing anything... but, User it's not a Customer only Owners are Customers... i mean, Not every user its a owner of a group but every owner of a group its a customer. (Here, maybe, have to agregate something). Are a Top Level class CONTACTS, Customers, Suppliers and Users inherit from that class, but Owners inherit from Customers. (Hope be clear now). – Rafael E. Ferrero Feb 28 '13 at 11:35
  • Just trying to get this clear - does a user have an associated customer or is a customer a type of user or is there any relationship between them? – kbbucks Feb 28 '13 at 15:10
  • Maybe i cant explain me quit well. A User is not a Customer, only Owners are Customers (but like i said, one Owner its one User, but not every User can be a Owner... its tricky). Hope you can undestand me. Cheers !! – Rafael E. Ferrero Mar 01 '13 at 15:59
  • so a group will have one user as an owner as well as the owner being a Customer - if that's the case would this do it?: **User**: ID, Name, GroupID **Group**: ID, Name **OwnerCustomer**: ID, Name, GroupID, OwnerUserID (UserID), GroupID – kbbucks Mar 01 '13 at 21:00