Page 1 of 1

Not possible to update using join

Posted: Wed Dec 07, 2011 1:39 am
by VisiGod
I'm trying to update a table using a mysql query that relies on join but using the standard $query->update and $query->join, Joomla just ignores my joins.

Example:

Code: Select all

...
$query->update('#__users AS u');
$query->join('LEFT', '`#__temp_users_check` AS fmt ON u.username = fmt.name');
$query->join('LEFT', '`#__tracker_users_level` AS ul ON ul.id = fmt.ugroup');
$query->set('u.id_level = fmt.ugroup');
$query->set('u.wait_time = ul.wait_time');
$query->where('u.id IN ( '.$uids.' )');
...
Expected result:

Code: Select all

UPDATE #__users AS u LEFT JOIN #__temp_users_check AS fmt ON u.username = fmt.name LEFT JOIN #__tracker_users_level AS ul ON ul.id = fmt.ugroup SET u.id_level = fmt.ugroup , u.wait_time = ul.wait_time WHERE u.id IN ( 3,4,6,8 )
Given result:

Code: Select all

UPDATE #__users AS u SET u.id_level = fmt.ugroup , u.wait_time = ul.wait_time WHERE u.id IN ( 3,4,6,8 )
Is this the expected behavior (the Given result), a bug, or my error?

Note: Just opened a tracker issue.