Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on May 7th, 2012  |  syntax: None  |  size: 0.76 KB  |  hits: 16  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. INSERT INTO term_node values (
  2.     SELECT i.nid,i.vid,term_node.tid FROM term_node
  3.     JOIN node_revisions       AS nr  ON nr.vid = term_node.vid
  4.     JOIN term_data            AS td  ON td.tid = term_node.tid
  5.     JOIN content_type_product AS ctp ON ctp.vid = nr.vid
  6.     JOIN node                 AS i   ON i.nid = ctp.field_product_imageref_nid
  7. );
  8. -- AFTER
  9. INSERT INTO term_node values (
  10.     SELECT nri.nid,i.vid,term_node.tid FROM term_node
  11.     JOIN node_revisions       AS nr  ON nr.vid = term_node.vid
  12.     JOIN term_data            AS td  ON td.tid = term_node.tid
  13.     JOIN content_type_product AS ctp ON ctp.vid = nr.vid
  14.     JOIN node                 AS i   ON i.vid = ctp.field_product_imageref_nid
  15.     JOIN node_revisions       AS nri ON nri.vid = i.vid
  16. );