数据库查询近七天的数据

1.查询近七天的数据

SELECT * FROM agentclass WHERE platformid = 1 AND unionname = '联盟1' AND levelname = '级别1' AND DATE_SUB(CURDATE(), INTERVAL 7 DAY) <= DATE(intime) AND intime < CURRENT_DATE () GROUP BY intime;

2.查询昨日的数据

SELECT intime,innumber FROM agentclass WHERE platformid = 1 AND unionname = '联盟1' AND levelname = '级别1' AND TO_DAYS( NOW( ) ) - TO_DAYS( intime) <= 1 AND intime < CURRENT_DATE () GROUP BY intime;


你可能感兴趣的:(学习总结)