-2

我想获取某个日期间隔之间的所有行,结果集最多为 50 条记录。可以查询什么?我不断收到错误:

$sql = "SELECT DISTINCT userId FROM ".$TableName.
       " where time BETWEEN (NOW() - INTERVAL "
       .$USER_COUNT_DURATION.
       " MINUTE AND NOW())  LIMIT 0, ".$limit." ;";
4

1 回答 1

1

看起来像括号问题。“分钟和现在())”应该是“分钟)和现在()”

$sql = "SELECT DISTINCT userId FROM ".$TableName." where time BETWEEN (NOW() - INTERVAL ".$USER_COUNT_DURATION." MINUTE) AND NOW() LIMIT 0, ".$limit." ;";
于 2012-07-24T12:19:21.077 回答