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

TP5 里面如何查询一个字段比另一个字段大的数据合集?

  •  
  •   crist · 2018-01-05 17:30:15 +08:00 · 5236 次点击
    这是一个创建于 2275 天前的主题,其中的信息可能已经有所发展或是发生改变。

    RT,这两个字段都是整形的时间戳数字,然后我使用下面方法: $maps['lastime'] = ['exp', "lastime > respontime"];

    结果: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'lastime > respontime ) ORDER BY id desc LIMIT 6000' at line 1[/var/……/thinkphp/library/think/db/Connection.php:388]

    3 条回复    2018-05-07 09:43:11 +08:00
    abccccabc
        1
    abccccabc  
       2018-01-06 08:58:18 +08:00
    试下:where('lasttime', '>', 'respontime')
    chelsea2019
        2
    chelsea2019  
       2018-05-07 00:36:08 +08:00 via iPhone
    可以加一下你 qq 和微信吗
    crist
        3
    crist  
    OP
       2018-05-07 09:43:11 +08:00
    @chelsea2019 不用了,答案是$maps['lastime'] = ['exp', "> respontime"];
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   2790 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 32ms · UTC 11:49 · PVG 19:49 · LAX 04:49 · JFK 07:49
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.