Access 中比较时间sql语句如何实现 Access中存储的时间跟当前时间比较,数据库中时间格式:2005-7-5 15:23:35 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 select * from table1 where dateField < now()普通比较,就是这样,如果要计算天,月,年,甚至小时,分钟的,差额。就要用到datediff(,,,) 类似这样:select * from EventLog where theTime>=#2009-12-17 11:20:35# and ...(其中theTime为数据库中的时间) 如果是datetime类型的那么你用CString strsql;CString strcurtime; // 格式应该是 2009-12-17 11:23:30strsql.Format("select * from 表名 where where 列名 < ('%s.999')",strcurtime); SELECT * FROM 表名 WHERE 列名 < now() //或者在程序中先获取当前时间,传入SQL语句CString str;COleDateTime tm;tm = COleDateTime::GetCurrentTime();str = tm.Format("%Y-%m-%d %H:%M:%S");str.Format("SELECT * FROM 表名 WHERE 列名 < '%s'", str); 我就是不想再获取时间,想直接通过sql来比较比如:SELECT * FROM 表名 WHERE 列名 < now() 不知道now()得到的时间是什么格式的,有没有精确到秒 应该可以直接比较的啊,now是datatime类型,默认是精确到秒的 请教高手 如何同时绘制三条动态曲线,一条曲线通过了 CString 怎样转换成 WCHAR string VC 里怎样用程序生成 XML 文档? VC 用GetPrivateProfileString读取ini文件问题 请问如何加长ComboBox的下拉选单? CListBox ASP中怎样调用COM组件? 如何获得系统系统内所有进程的路径及文件名? 用tcp协议 时 服务端要先建立一个套接字 然后监听,等待连接,但连接后为什么要新创建一个套接字啊 如何实现PHOTOSHOP中的图像的对比度和亮度的调节功能? 登录框的制作? 急~!MFC opengl 运行没反应
select * from EventLog where theTime>=#2009-12-17 11:20:35# and ...(其中theTime为数据库中的时间)
CString strsql;
CString strcurtime; // 格式应该是 2009-12-17 11:23:30
strsql.Format("select * from 表名 where where 列名 < ('%s.999')",strcurtime);
COleDateTime tm;
tm = COleDateTime::GetCurrentTime();
str = tm.Format("%Y-%m-%d %H:%M:%S");
str.Format("SELECT * FROM 表名 WHERE 列名 < '%s'", str);
比如:SELECT * FROM 表名 WHERE 列名 < now()
不知道now()得到的时间是什么格式的,有没有精确到秒