條款我發現這個博客帖子裏介紹的方式攫取從表中隨機行:http://www.rndblog.com/how-to-select-random-rows-in-mysql/RAND()在MYSQL中
我用它在我試圖限制重刪除查詢它的工作,同時也很快。
DELETE table1 FROM table1
JOIN table2 ON table2.id = table1.salesperson_id
JOIN table3 ON table3.id = table2.user_id
JOIN table4 ON table3.office_id = table4.id
WHERE table1.type = "Snapshot"
AND table4.id = 113 OR table4.parent_id =113
AND RAND()<=0.001;
我不明白這是如何工作的。我嘗試了大量Google搜索,但是我沒有發現任何有關以這種方式使用的WHERE子句中的RAND()。 文檔也沒有提供任何有關這方面的信息。
預先感謝您。
P.S.我正在使用MYSQL 5.5