for building my website i am implementing a tree-style data organization.
for that i have a mysql table called 'jm_tree':
CATID,          int(10)    auto_increment      -> Index
PARENT,      int(10)                                       ->the CATID of
the 'parent' node
TEXT,           varchar(40)                              -> small
TYPE            set('FOLDER','FILE','LINK','POST')   -> the type of object

and for each TYPE of object i have a corresponding table like :

ex.: for a TYPE 'FILE' i have a 'jm_files' table [ that has the CATID field
also ( as a FK ) ]
with all the files related to that node.

i want to know is ( and i am perfectly aware that this in possible using
multiple queries and PHP ) if  it's possible that in one MySQL query to
INNER JOIN the 'jm_tree' table to the specifical table ( jm_files, jm_links,
fo fo fo )
according to the contents of the 'jm_tree.type'

99%-possibility-of-being-wrong-something-like-example :)

SELECT * FROM jm_tree INNER JOIN jm_files IF jm_tree.type='FILE'
                            INNER JOIN jm_links IF jm_tree.type='LINKS'

Best Regards,

José Moreira
Técnico de Informática | IT Technician
Vila Nova de Gaia, Portugal
ICQ: 136936120
IRC: gray (

PHP Database Mailing List (
To unsubscribe, visit:

Reply via email to