crist
V2EX  ›  PHP

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

  •  
  •   crist · Jan 5, 2018 · 6361 views
    This topic created in 3057 days ago, the information mentioned may be changed or developed.

    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 replies    2018-05-07 09:43:11 +08:00
    abccccabc
        1
    abccccabc  
       Jan 6, 2018
    试下:where('lasttime', '>', 'respontime')
    chelsea2019
        2
    chelsea2019  
       May 7, 2018 via iPhone
    可以加一下你 qq 和微信吗
    crist
        3
    crist  
    OP
       May 7, 2018
    @chelsea2019 不用了,答案是$maps['lastime'] = ['exp', "> respontime"];
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   4631 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 38ms · UTC 09:49 · PVG 17:49 · LAX 02:49 · JFK 05:49
    ♥ Do have faith in what you're doing.