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
https://forums.phpfreaks.com/topic/135369-solved-help-with-constructing-my-query/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.