Hi,
I have three tables setup in mysql for a message
system.
The first has all the messages, author's names, and
the unique ids of the categories and subcategories.
The second has a listing of all the categories names
and ids.
The third has a listing of all the subcategories names
and ids.
All messages must have a category, but they are not
required to have a subcategory. It's set up in a tree
stucture like below (hope this is formatted ok)
Main -> subcat -> some message
-> another subcat -> even another message
-> message
-> another message
I'm trying to create a query that will select certain
messages (with any bound. On one query I might use an
'id' check, on another query I might use LIKE to check
the content of the message), the messages' categories,
and the messages' subcategories (but only if the
message has a subcategory)
The problem arises when I try to select from the
subcategory table when there is no subcategory. I'm
getting very weird results that are either 16-18 of
the same row, or the complete lack of all rows that do
not have subcategories.
Please let me know if this isn't clear.
Any help would be appreciated...
Best Regards,
Bill Zeller
I have three tables setup in mysql for a message
system.
The first has all the messages, author's names, and
the unique ids of the categories and subcategories.
The second has a listing of all the categories names
and ids.
The third has a listing of all the subcategories names
and ids.
All messages must have a category, but they are not
required to have a subcategory. It's set up in a tree
stucture like below (hope this is formatted ok)
Main -> subcat -> some message
-> another subcat -> even another message
-> message
-> another message
I'm trying to create a query that will select certain
messages (with any bound. On one query I might use an
'id' check, on another query I might use LIKE to check
the content of the message), the messages' categories,
and the messages' subcategories (but only if the
message has a subcategory)
The problem arises when I try to select from the
subcategory table when there is no subcategory. I'm
getting very weird results that are either 16-18 of
the same row, or the complete lack of all rows that do
not have subcategories.
Please let me know if this isn't clear.
Any help would be appreciated...
Best Regards,
Bill Zeller