0

Hi I have 3 tables in my database.
1) photo
2) category
3) subcategory

in my photo table i save my subcategoryid which is tied to the category table.

What i need to do is get the all the subcategoryname from subcategory table where photo.subcategoryid='1' and photoid='2'.

I can actually get the value, but what i want is also to display all the other values in subcategory table that share the same categoryid for the particular photoid.

lets say my photoid is 1 and my subcategoryid is 2 , so when check in category table , the categoryid for subcategory 2 is 3. How can i display other subcategories which is the same as categoryid 3

i hope my question is clear. Please help me on this.

eg


category table
categoryid
1
2
3
4

subcategorytable
subcategoryid
1
2
3
4

categoryid
1
1
2
2

3
Contributors
2
Replies
3
Views
9 Years
Discussion Span
Last Post by SheSaidImaPregy
0

Describe for me what's Photo, Category and Subcategory table?? the descrription of each of which I may help you!

0

Question, why is your subcategory in your category table? Currently it is like this:

Category
      /        \
Photos          Subcategory

Why don't you make it like this:

Category
             \
               Subcategory
                           \
                            Photos

Like this:

Category
- CategoryID

Subcategory
- SubcategoryID
- CategoryID

Photos
- PhotoID
- SubcategoryID
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.