“and”日期问题
select a.ddate ,a.did from m_stockcontent as a where a.ddate > 2008-03-07显示2条记录
2008-08-08 00:00:00.000 1101
2009-01-01 00:00:00.000 1101
当我加入一个条件
select a.ddate ,a.did from m_stockcontent as a where a.ddate > 2008-03-07 and a.ddate<2018-04-07
没有找到一行
回复 1# 的帖子
select a.ddate ,a.did from m_stockcontent as a where a.ddate between '2008-03-07' and '2018-04-07' 不知道你的SQL为什么不提示错误,有两点:第一:你的日期格式没有''号,第二:我不知道你在数据库里的日期格式是不是就2008-01-01的格式还是2008-01-01 00:00:0000,你可以用convert(char(10),变量,120)转换下,试试看 日前格式要用#号啊 日期型和字符型要使用单引号.页:
[1]
