简体   繁体   English

过滤过去 24 小时的数据并从 SQL 收集数据

[英]filter last 24 hour data and collect data from SQL

The following code seems to be not working for me, what went wrong.以下代码似乎对我不起作用,出了什么问题。

$que = "SELECT * FROM people WHERE phone=9876543210 WHERE status=10 AND clickdate > DATE_SUB(CURDATE(), INTERVAL 1 DAY)";

Intention was to collect data of users with the phone number 9876543210 and status=10, but only within last 24 hours from the table "people".目的是收集电话号码为 9876543210 且状态为 10 的用户的数据,但只能从“人员”表中收集过去 24 小时内的数据。 "clickdate" is the date column in database. “clickdate”是数据库中的日期列。

You have two WHERE in your query.您的查询中有两个WHERE Replace second where with and将第二个where替换为and

SELECT * 
FROM people 
WHERE phone=9876543210 
AND status=10 
AND clickdate > DATE_SUB(CURDATE(), INTERVAL 1 DAY)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM