select * from tablename where ddate between #2007-1-1 00:00:01# and #2007-1-4 23:59:59#
可以在SQL查询中把日期型转化为固定格式的字符串,这样不只可以查询某日的,也可以查询某年的,某月的,某时的,某秒的,因为本人一直在SQLServer2000下编程,不知道ACCESS相关的SQL函数,还请高手们来给出这些函数吧 在SQL Server 2000中这样写: select * from 表名 where convert(char(10),日期字段,120)='2007-01-05'
access用format:select * from tb where format(youDate,"yyyy-mm")='2006-12'
access用format:select * from tb where format(youDate,"yyyy-mm-dd")='2006-12-25'
在SQL Server 2000中这样写:
select * from 表名 where convert(char(10),日期字段,120)='2007-01-05'
where format(youDate,"yyyy-mm")='2006-12'
where format(youDate,"yyyy-mm-dd")='2006-12-25'
and not 日期字段 is null