I have a question that I hope I can explain well enough:
I am trying to figure out a data structure for an inventory system. The
system contains:
Items
Kits (Made from a collection of Items and/or other Kits)
Now my question is:
Is there any way to structure this in a database so that I could run a
single query to get the contents of a kit, even though it contains other
kits?
My problems occur when I try to create the tables as so:
ITEMS: KIT_CONTENTS KITS
KIT_ID<---------------->KIT_ID
ITEM_ID<--------->ITEM_ID Description
Description
Price
Etc
The only way I could think of to allow a kit to be contained within a kit:
Add another field to KIT_CONTENTS called Sub_Kit
Which seems like a dumb way of doing it, because first of all, most kits
don't have sub kits, so that would be a wasted field in most cases.
Secondly, as far as I know the application logic would have to do multiple
queries's to get the sub_kits.
I really hope there is a simple and more logical way to do this, preferably
allowing me to run a SINGLE query that will show a kit with all its sub
kits. Otherwise I would need to have repeated queries from the application
logic, and I really want to avoid that.
Please help, thanks.
--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe: http://lists.mysql.com/my***********...ie.nctu.edu.tw