insert into user_variable (user_variable_user_id, user_variable_variable_id, user_variable_value)
select
user.user_id as `user_variable_user_id`,
variable.variable_id as `user_variable_variable_id`,
0 as `user_variable_value`
from
user left join variable on 1
left join user_variable on
user.user_id=user_variable.user_variable_user_id
and variable.variable_id=user_variable.user_variable_variable_id
where user_variable.user_variable_id is null;
select
variable.variable_name as `name`,
user_variable.user_variable_value as `value`
from
user_variable
left join user
on user_variable.user_variable_user_id = user.user_id
left join variable
on user_variable.user_variable_variable_id = variable.variable_id
where user.user_login = ;