RAND() In WHERE clause in MYSQL

前端 未结 2 1536
栀梦
栀梦 2021-01-24 01:48

I\'ve found this Blog post that shows a way to grab a random rows from a table : http://www.rndblog.com/how-to-select-random-rows-in-mysql/

I used it in a heavy delete q

2条回答
  •  一生所求
    2021-01-24 02:11

    This is an example to use clause WHERE with RAND in mySQL:

    SELECT * FROM t1
    WHERE status = 1
    ORDER BY RAND() LIMIT 2;
    

提交回复
热议问题