Jump to content

[SOLVED] Help with constructing my query


Darkmatter5

Recommended Posts

I have 3 tables

 

Cabinets

  cabinet_id

  cab_name

 

Folders

  folder_id

  fol_name

  cabinet_id

 

Items

  item_id

  item_name

  folder_id

 

Here's some sample data in each table:

Cabinets:

  1, cab1

  2, cab2

  3, cab3

 

Folders:

  1, fol1, 1

  2, fol2, 1

  3, fol3, 2

 

Items:

  1, item1, 1

  2, item2, 2

  3, item3, 3

  4, item4, 1

 

Now I need to make a query that will list all items from Items that are ultimately within a specific Cabinet.

 

Example..

1. item1 is in fol1 which is in turn in cab1

2. item2 is in fol2 which is in turn in cab1

3. item4 is in fol1 which is in turn in cab1

 

So how can I list all items ultimately in cab1 or cab2 or cab3.  I know I have to use a JOIN, but I'm not sure how.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.