New Podcast

Posted Tuesday, January 31 at 3:28 pm
  Thomas Turnbull (tom_o_t on drupal.org) and Alan Palazzolo (zzolo on drupal.org) join Mike Anello to talk about their new book from O’Reilly Media, Mapping with Drupal. Mike’s usual co-hosts, Andrew and Ryan, were both unable to participate in the podcast, leaving Thomas and Alan subject to Mike’s long-winded (but extremely interesting by some accounts) questions.
Download Podcast 73
DrupalEasy_ep73_20120131.mp3
Syndicate content

NEWSLETTER

Stay informed on our latest news!

Syndicate content

Testimonial

Mike quickly spotted several flaws in our Drupal configuration and was able to teach us how to correct them. His training style and solid knowledge of Drupal makes for an efficient and productive training session. I came away with full confidence in the data I learned that day.

Who are we?

DrupalEasy is the collective expertise of Ryan Price and Michael Anello, who joined forces to provide training and consulting services worldwide. Read all about them and what they can do.

What is Drupal?

Drupal is a free, super-powerful content management system for sites that require information posting and collection, including blogs, forums, videos, photos, and databases of information. We think it is the best platform available. Here's why...

Why Drupal?

More and more savvy organizations are going with Drupal for content management, and its no mystery why. It’s free, flexible, and easy to maintain for small or large volume sites. Learn more...

Relate all nodes from one taxonomy to another with MySQL

No votes yet

When using taxonomy to group nodes on your Drupal site, you find a need to apply another taxonomy term to all of those nodes (possibly from a different vocabulary) there is nothing that is going to be shorter and sweeter than some quick SQL-fu.

Here is a quick MySQL snippet to do just that:

create temporary table my_temp_table as
select * from term_node where tid = XXX;
insert into term_node (nid,tid) select nid, 'YYY' as tid from my_temp_table

Just replace XXX with the TID of the term that is already grouping your content, and replace YYY with the TID of the term you want to apply to all of them. You can comment out the first and last lines to use the select statement to check to make sure that these are the nodes you're after before committing all of the insert statements to the Database.

Enjoy!

Trackback URL for this post:

http://drupaleasy.com/trackback/13

3 comments

user picture
Lopsta Ecommerce wrote 3 years 9 weeks ago

does anyone know a way to

does anyone know a way to build a related nodes link block not based on taxonomy, but on similarity in the node title?

Nicholas Thompson wrote 3 years 18 weeks ago

Cant this be simplified

5

Cant this be simplified to...

INSERT INTO term_node (nid,tid) SELECT nid, Y FROM term_node WHERE tid = X;

Pingback

[...] Go to the author’s original blog: Relate all nodes from one taxonomy to another with MySQL [...]

Syndicate content