Is there any way to
db_update() for the following query?
UPDATE field_data_field_TEST as ft left join node as n on ft.entity_id = n.nid set n.type='test' where n.type='foo'
I tried using
db_update()->join(); but it didn't work.
Drupal Answers is a question and answer site for Drupal developers and administrators. It only takes a minute to sign up.Sign up to join this community
db_update() doesn't implement any interfaces that have
innerJoin()/etc. methods so I think you're stuck with using
db_query() and writing the query string out manually.
$sql = " UPDATE field_data_field_TEST as ft left join node as n on ft.entity_id = n.nid set n.type = :type1 where n.type = :type2"; $args = array(':type1' => 'test', ':type2' => 'foo'); db_query($sql, $args);