绕过#1136 - 列数与第1行的值计数不匹配?

时间:2016-04-28 22:48:02

标签: mysql

我想在alerts_data中只插入3个第一列。我知道值必须与列的数量相同,但如果我删除future_conditions_views,则查询将无效。 我怎样才能插入前3个?

INSERT INTO alerts_data (alerts_data_hash, alerts_data_id, alerts_data_hash_id)
SELECT behaviour.hash, future_conditions_alert, , CONCAT(behaviour.hash, future_conditions_alert) AS alerts_data_hash_id, future_conditions_views
FROM behaviour, active, future_conditions
WHERE behaviour.hash = active.hash
AND behaviour.url = future_conditions_url
AND active.last_active >= NOW( ) - INTERVAL 1 MINUTE 
AND behaviour.timestamp >= NOW( ) - INTERVAL future_conditions.future_conditions_day DAY 
GROUP BY behaviour.hash, behaviour.url
HAVING COUNT( * ) >= future_conditions.future_conditions_views
ON DUPLICATE KEY UPDATE alerts_data.alerts_data_hash_id = alerts_data.alerts_data_hash_id

0 个答案:

没有答案