V2EX = way to explore
V2EX 是一个关于分享和探索的地方
Sign Up Now
For Existing Member  Sign In
crist
V2EX  ›  PHP

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

  •  
  •   crist · Jan 5, 2018 · 6313 views
    This topic created in 3041 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   ·   2670 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 35ms · UTC 04:00 · PVG 12:00 · LAX 21:00 · JFK 00:00
    ♥ Do have faith in what you're doing.