$rDate1 = datetime::createFromFormat('d/m/Y H:i:s','20/12/2015 13:56:00');
$rDate2 = datetime::createFromFormat('d/m/Y H:i:s','03/05/2014 14:54:00');
var_dump($rDate1->diff($rDate2));
update table1 left join (select query, sum(amount) as amount from table2 group by query) as t2 using(query) set table1.amount = ifnull(t2.amount, 0 /*значение по-умолчанию, если в table2 таких query нет ни одного*/)
`users' prints on a single line a blank-separated list of user names of
users currently logged in to the current host. Each user name
corresponds to a login session, so if a user has more than one login
session, that user's name will appear the same number of times in the
output.