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? Quote 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 Quote 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"); Quote 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. Quote Link to comment https://forums.phpfreaks.com/topic/168770-how-do-you-join/#findComment-890918 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.