34,590
社区成员
发帖
与我相关
我的任务
分享
1.select * from tab where DATETIME between '2007-1-1 10:00:00' and '2009-4-18 12:00:00'
方法二:2、select * from tab where DATETIME>'2007-1-1 10:00:00' and DATETIME<'2009-4-18 12:00:00'
select *
from tb
where cast(DATETMP+' '+TIMETM as datetime) between '2007-1-1 10:00:00' and '2009-4-18 12:00:00'
改正.select *
from tb
where cast(DATETMP+' '+TIMETM as datetime) between '2007-1-1' and '2009-4-18'
楼主以下是不是你想要的结果
select * from tab where DATETIME between '2007-1-1 10:00:00' and '2009-4-18 12:00:00'
union
select * from tab where TIMETMP between '2007-1-1 10:00:00' and '2009-4-18 12:00:00'