Perad Posted August 4, 2009 Share Posted August 4, 2009 Table 'term_taxonomy' term_taxonomy_id|term_id|taxonomy|description|parent|count Table 'terms' term_id|name|slug|term_group What I need to do is this.. SELECT term_taxonomy_id FROM term_taxonomy WHERE taxonomy='category' I then need to reference term_taxonomy_id with term_id to get the name. How do I do this in a single query? Link to comment https://forums.phpfreaks.com/topic/168770-how-do-you-join/ Share on other sites More sharing options...
kickstart Posted August 4, 2009 Share Posted August 4, 2009 Hi Something like this SELECT term_taxonomy.term_taxonomy_id, terms.name, terms.term_id FROM terms INNER JOIN term_taxonomy ON terms.term_id = term_taxonomy.term_id WHERE taxonomy='category' All the best Keith Link to comment https://forums.phpfreaks.com/topic/168770-how-do-you-join/#findComment-890419 Share on other sites More sharing options...
dreamwest Posted August 4, 2009 Share Posted August 4, 2009 Simplest join possible $result = mysql_query("SELECT * FROM term_taxonomy AS a, terms as b WHERE a.term_id=b.term_id"); Link to comment https://forums.phpfreaks.com/topic/168770-how-do-you-join/#findComment-890421 Share on other sites More sharing options...
fenway Posted August 4, 2009 Share Posted August 4, 2009 Yes-- except the comma operator is EVIL and should never, EVER be used. Link to comment https://forums.phpfreaks.com/topic/168770-how-do-you-join/#findComment-890918 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.