0
笨版本:2.1.3
的MySQL版本:30年5月5日
MySQL的引擎:MyISAM數據笨和mysql用戶自定義變量不工作
查詢:
$query = "INSERT INTO new_table
(
user_id,
cut_off_pay,
total_days,
rate_per_day,
rate_per_hour,
)
(
SELECT
u.id,
@cut_off_pay := (u.current_salary/2) ,
@total_days := 10,
@rate_per_day := (@cut_off_pay/@total_days),
@rate_per_hour := (@rate_per_day/8)
FROM attendance a
LEFT JOIN users u
ON a.user_id = u.id
WHERE a.user_id = u.id
GROUP BY a.user_id
)";
$this->db->query($query);
用戶定義的變量(@cut_off_pay,@total_days等)不起作用,它返回0/NULL值
@scoohh有沒有幫助? – peterm