public static function formatOn($on, $r = '')
    {
        if (isset($on[0]) && is_array($on[0])) {
            foreach ($on as $on2) {
                $r = self::formatOn($on2, $r);
            }
        } else {
            $on2 = array_keys($on);
            $r .= (!empty($r) ? ' AND ' : '').'`'.key($on).'`.`'.current($on).'` = `'.next($on2).'`.`'.next($on).'`';
        }

        return $r;
    }