求固定时间的前一天? 对mySql不熟悉,有一这个查询要求,我的表中有一个时间字段time,求最大time的前一天的信息,逻辑部分上这样的select * from table where time>= max(time) -1不知道用mySql的什么函数,求各位高手给个答案 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 select * from table where time < DATE_SUB(now(), INTERVAL 1 DAY)也可能是INTERVAL 2 DAY,不太记得了,自己试试吧 now()不行,所有时间参照只能以time 为准,不能有系统当前时间 select * from ext where day(add_time) = day(select max(add_time) from ext) -1这句话为什么不行? 试试下面的语句:mysql>select * from table where time>= (select date_sub(max(time),interval 1 day) from table); select * from table where time = DATE_SUB(now(), "INTERVAL 1 DAY"); 不能用now()函数,我不需要和当前时间比较 select * from table where year(datetime) = year(max(datetime)) and month(datetime) = month(max(datetime)) and day(datetime) = day(max(datetime)) - 1 不能用now()函数,我不需要和当前时间比较================你把now()函数改成你的不就行了. select * from table where dayofyear(now()) - dayofyear(datetime) = 1 这种运算是不是mysql不合适? mysql数据库表中存入1,取出来却变成了49. Mysql ignore into的疑问 mysql中如何创建服务器 psql支持递归查询吗? MYSQL有没有如MSSQL中的IF BEGIN END;这样的逻辑控制表达式 关于分组后的排序问题! 有请各位高人 现在mysql的最新版本是多少啊 很好得的分哦,数据库连接问题,在线等 Top问题 乞求一sql写法 mysql中列值为非空怎么还能写数据 帮我看看啊,为什么总是连不上
也可能是INTERVAL 2 DAY,不太记得了,自己试试吧
mysql>select * from table where time>= (select date_sub(max(time),interval 1 day) from table);
select * from table where time = DATE_SUB(now(), "INTERVAL 1 DAY");
================
你把now()函数改成你的不就行了.