当前位置: 代码迷 >> Sql Server >> 怎么查询查询条件为明天的查询
  详细解决方案

怎么查询查询条件为明天的查询

热度:86   发布时间:2016-04-27 20:43:51.0
如何查询查询条件为明天的查询.
我知道查询查询条件为今天的查询的查询语句是:select   from   *   from   tabelname   where   searchcondition=getdate()
那么如果查询的条件为明天呢!
急,请高人帮助.

------解决方案--------------------
select from * from tabelname where searchcondition=getdate()+1
------解决方案--------------------
今天:
select from * from tabelname
where searchcondition
between Convert(datetime, SubString(Convert(varchar(30), getdate(), 120), 1, 10) + ' 00:00:00 ')
and Convert(datetime, SubString(Convert(varchar(30), getdate(), 120), 1, 10) + ' 23:59:59.999 ')

明天的把getdate()改成dateadd(day,1,getdate())就可以了
------解决方案--------------------
--得到日期
select from * from tabelname where searchcondition=convert(char(10),getdate()+1,120)
select from * from tabelname where searchcondition=convert(char(10),dateadd(day,1,getdate()),120)
  相关解决方案