search

Home  >  Q&A  >  body text

随机数 - php mysql 带查询条件 获取多条随机记录

阿神阿神2786 days ago668

reply all(2)I'll reply

  • ringa_lee

    ringa_lee2017-04-17 16:27:24

    It’s best to leave this to PHP, for example, randomize the ID in advance

    reply
    0
  • 阿神

    阿神2017-04-17 16:27:24

    Get 10 random records with query conditions:

    SELECT * FROM yourTable WHERE yourTable.status=0 ORDER BY RAND() LIMIT 10;

    The consumption will be very large, use it as appropriate after testing.

    reply
    0
  • Cancelreply