verifier
May 17th, 2004, 09:02 AM
Hello
Im creating an app that should organize data under different groups. And each can have X sub groups. A group can only have one parent.
GroupTable
=========
groupId
parentId
name
Pretty straightforward, right?
Lets say that I got these groups:
MyCompany::Stockholm::Support::Director
MyCompany::Stockholm::Support::Technician
MyCompany::Stockholm::Sales::Salesman
MyCompany::Stockholm::Sales::Sales support
MyCompanygot id 1, parent 0
Stockholm 2 with parent 1
Support 3 with parent 2
Director 4 with parent 3
Technician 5 with parent 3
Sales 6 with parent 2
Salesmen 7 with parent 6
Sales support 8 with parent 6
How do I list all persons in Stockholm? Or how do I list all in sales department.
Are there a better database design for this task?
Im creating an app that should organize data under different groups. And each can have X sub groups. A group can only have one parent.
GroupTable
=========
groupId
parentId
name
Pretty straightforward, right?
Lets say that I got these groups:
MyCompany::Stockholm::Support::Director
MyCompany::Stockholm::Support::Technician
MyCompany::Stockholm::Sales::Salesman
MyCompany::Stockholm::Sales::Sales support
MyCompanygot id 1, parent 0
Stockholm 2 with parent 1
Support 3 with parent 2
Director 4 with parent 3
Technician 5 with parent 3
Sales 6 with parent 2
Salesmen 7 with parent 6
Sales support 8 with parent 6
How do I list all persons in Stockholm? Or how do I list all in sales department.
Are there a better database design for this task?