V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
jurant
V2EX  ›  PHP

laravel 随机取 10 条不同的怎么取

  •  
  •   jurant · 2017-01-12 19:35:51 +08:00 · 2713 次点击
    这是一个创建于 2651 天前的主题,其中的信息可能已经有所发展或是发生改变。

    随机取 10 条不同的数据

    2 条回复    2017-02-14 15:40:47 +08:00
    phpman
        1
    phpman  
       2017-01-18 16:27:57 +08:00
    随机 10 个 id 不就行了
    luishou
        2
    luishou  
       2017-02-14 15:40:47 +08:00
    SELECT * FROM `table` ORDER BY RAND() LIMIT 10;
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   3344 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 31ms · UTC 12:42 · PVG 20:42 · LAX 05:42 · JFK 08:42
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.