dongyingtang3803 2010-01-05 19:59
浏览 24
已采纳

Mysql的。 限制$ x1,$ x2。 是否可以限制$ x2,$ x1?

For example, $x1 = 10, $x2 = 25 then it will work Limit $x1, $x2. But I want to make Limit $x2, $x1 and it doesn't work. I want to get from newest to oldest entry from that list. ORDER BY doesn't work

edited you can close it, I've figured out by myself. I use

ORDER BY a_time DESC LIMIT $x2-$x1

now, so thanks.

  • 写回答

2条回答 默认 最新

  • dongyinju5977 2010-01-05 20:21
    关注

    To select the first 10 rows...

    SELECT * FROM customer ORDER BY id ASC LIMIT 0, 10
    

    To select the last 10 rows....

    SELECT * FROM customer ORDER BY id DESC LIMIT 0, 10
    

    This tells the script to start at 0, then count 10 rows. This is the best/most efficient way of doing this.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥15 2024-五一综合模拟赛
  • ¥15 下图接收小电路,谁知道原理
  • ¥15 装 pytorch 的时候出了好多问题,遇到这种情况怎么处理?
  • ¥20 IOS游览器某宝手机网页版自动立即购买JavaScript脚本
  • ¥15 手机接入宽带网线,如何释放宽带全部速度
  • ¥30 关于#r语言#的问题:如何对R语言中mfgarch包中构建的garch-midas模型进行样本内长期波动率预测和样本外长期波动率预测
  • ¥15 ETLCloud 处理json多层级问题
  • ¥15 matlab中使用gurobi时报错
  • ¥15 这个主板怎么能扩出一两个sata口
  • ¥15 不是,这到底错哪儿了😭