sql有关问题,有product表,表中会随着时间持续更新数据,现在的要求是找到前一个小时内的product表中的数据(也就是小时粒度), select * from product where 请问改在where后加上什么条件
首先你的product表肯定有一个记录时间的字段吧,我们假设它是time,你自己替换成你自己的字段就行。
那么sql为:select * from product where time >= NOW() - INTERVAL 1 HOUR;
一般不都是在表内增加时间字段嘛?然后根据时间字段去查
product表中有记录时间的字段列吗