Forum Moderators: coopster & phranque

Message Too Old, No Replies

Recursive MySQL query

         

aspr1n

6:19 pm on Mar 7, 2003 (gmt 0)

10+ Year Member



Would very much appreciate some thoughts on this one.

I have 4 "stationary" tables.

The 1st holds my pencils, and their attributes
The 2nd holds my pens, and their attributes
The 3rd holds my paperclips, and their attributes

Table No.4 is my pencil case table. Here I store which pencils, pens and paperclips exist in which pencil case, thus:

ID, PencilCaseID, ItemType, ItemID

This is complicated due to this being a "quantum" pencil case, and the same item may exist in more than one pencil case at the same time.

To list all attributes at the same time for one pencil case the query would be:

SELECT * FROM pencilcase WHERE PencilCaseID = xyz

But how do I JOIN the item tables according to their ItemType returned from the above query?

cheers,

asp

aspr1n

7:04 pm on Mar 7, 2003 (gmt 0)

10+ Year Member



sorry should have searched a little harder:

[webmasterworld.com...]

asp