You need to have "keys" in each table to join them together. Once you have those "keys" in place, you can match the keys across the tables and use a WHERE clause to filter the results.
'Luck! -Mike ----- Original Message ----- From: "José Moreira" <[EMAIL PROTECTED]> To: "Php-Db" <[EMAIL PROTECTED]> Sent: Tuesday, June 25, 2002 6:48 AM Subject: [PHP-DB] INNER JOIN by field content > 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 > description > 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 > E-mail: [EMAIL PROTECTED] > MSN: [EMAIL PROTECTED] > ICQ: 136936120 > IRC: gray (irc.ptnet.org) > > -------------------------------------------------------------------------------- > -- > PHP Database Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php