4

何らかの理由で、このUPDATEクエリは永久にハングします。に置き換えるとSELECT、すぐに結果が得られます。

UPDATE table1 AS t1
INNER JOIN
(
    SELECT count(*) as total, left(number,7) as prefix, outcome FROM table1
    where outcome like '%Passed%'
    group by prefix 
    order by total desc limit 200
) AS t2 
ON t2.prefix = left(t1.number,7) AND t1.outcome = 'Fail'
SET t1.outcome = '', t1.status = 'NEW'

何が問題なのですか?

4

3 に答える 3

0

参加しているコラムを更新できますか? つまり、t1.outcome.

フィルター式t1.outcome = 'Fail'JOINand からWHERE句に移動します。

UPDATE table1 AS t1
INNER JOIN
(
    SELECT count(*) as total, left(number,7) as prefix, outcome FROM table1
    where outcome like '%Passed%'
    group by prefix 
    order by total desc limit 200
) AS t2 
ON t2.prefix = left(t1.number,7)
SET t1.outcome = '', t1.status = 'NEW'
WHERE t1.outcome = 'Fail'
于 2013-04-03T12:27:39.527 に答える