我有一個蘭德公司與限制,順序選擇,所以我得到的每status
的集數再搭配整體結果得到一個隨機結果不是對每個status
塊這樣的SQL查詢,並按照預期運行剛:SQL聯盟更新
(SELECT * FROM `vicidial_list` WHERE phone_number LIKE "7%" AND list_id NOT IN (500,1000) AND status = "AR" LIMIT 1038)
UNION
(SELECT * FROM `vicidial_list` WHERE phone_number LIKE "7%" AND list_id NOT IN (500,1000) AND status = "CBHOLD" LIMIT 372)
UNION
(SELECT * FROM `vicidial_list` WHERE phone_number LIKE "7%" AND list_id NOT IN (500,1000) AND status = "NEW" LIMIT 3824)
UNION
(SELECT * FROM `vicidial_list` WHERE phone_number LIKE "7%" AND list_id NOT IN (500,1000) AND status = "PI" LIMIT 1405)
UNION
(SELECT * FROM `vicidial_list` WHERE phone_number LIKE "7%" AND list_id NOT IN (500,1000) AND status = "NRP" LIMIT 500)
UNION
(SELECT * FROM `vicidial_list` WHERE phone_number LIKE "7%" AND list_id NOT IN (500,1000) AND status = "RCAT" LIMIT 500)
ORDER BY RAND()
現在我想它來更新list_id
到200,但是這並不工作:
(UPDATE `vicidial_list` SET list_id = 200 WHERE phone_number LIKE "7%" AND list_id NOT IN (500,1000) AND status = "AR" LIMIT 1038)
UNION
(UPDATE `vicidial_list` SET list_id = 200 WHERE phone_number LIKE "7%" AND list_id NOT IN (500,1000) AND status = "CBHOLD" LIMIT 372)
UNION
(UPDATE `vicidial_list` SET list_id = 200 WHERE phone_number LIKE "7%" AND list_id NOT IN (500,1000) AND status = "NEW" LIMIT 3824)
UNION
(UPDATE `vicidial_list` SET list_id = 200 WHERE phone_number LIKE "7%" AND list_id NOT IN (500,1000) AND status = "PI" LIMIT 1405)
UNION
(UPDATE `vicidial_list` SET list_id = 200 WHERE phone_number LIKE "7%" AND list_id NOT IN (500,1000) AND status = "NRP" LIMIT 500)
UNION
(UPDATE `vicidial_list` SET list_id = 200 WHERE phone_number LIKE "7%" AND list_id NOT IN (500,1000) AND status = "RCAT" LIMIT 500)
ORDER BY RAND()
有什麼建議?
謝謝。
沒有工會與UPDATE – Serg