2つのテーブルを結合し、CASEステートメントを使用してテーブルを更新しようとしています。
古いエラーコードが表示されます:1111グループ関数の使用が無効です。解決する方法について何かアイデアはありますか?
UPDATE table1 JOIN table2 ON (table1.ITEM = table2.ITEM)
SET table1.TURNOVERSCORE=CASE
WHEN ((COUNT(table2.ORDER_NUMBER))/12) < 1 AND table1.CAT = 'E' THEN .05
WHEN ((COUNT(table2.ORDER_NUMBER))/12) >= 1 AND ((COUNT(table2.ORDER_NUMBER))/12) < 4 AND table1.CAT = 'E' THEN .5
WHEN ((COUNT(table2.ORDER_NUMBER))/12) >= 4 AND table1.CAT = 'E' THEN 1
WHEN ((COUNT(table2.ORDER_NUMBER))/12) <= 5 AND table1.CAT != 'E' THEN .05
WHEN ((COUNT(table2.ORDER_NUMBER))/12) >= 6 AND ((COUNT(table2.ORDER_NUMBER))/12) < 11 AND table1.CAT != 'E' THEN .25
WHEN ((COUNT(table2.ORDER_NUMBER))/12) >= 11 AND ((COUNT(table2.ORDER_NUMBER))/12) < 21 AND table1.CAT != 'E' THEN .5
WHEN ((COUNT(table2.ORDER_NUMBER))/12) >= 21 AND table1.CAT != 'E' THEN 1 END