使用getdate方法

时间:2017-01-19 15:06:16

标签: sql sql-server-2008

我目前正在运行查询,但看不到问题

我想从2016年11月14日到现在的日期获取记录 我绝对可以运行我的第一个查询,但我想使用getdate()方法获取记录,直到今天(今天的日期) 所以我尝试了我的第二个查询,但我收到了一个错误。

Msg 102,Level 15,State 1,Line 20

')'附近的语法不正确。

    WHERE ( (ct.ServiceDate >= '11/14/2016') and (ct.ServiceDate <= '01/01/2017')  ) 
   and ct.ProgType = 'CMP'  and ct.Route !='NA' AND TimeIn IS NOT NULL AND TimeOut IS NOT NULL AND EntryUser IS NOT NULLde here




WHERE ( (cta.ServiceDate >= '11/14/2016') and (cta.ServiceDate <= GETDATE())  ) 
   and cta.ProgType = 'SchoolProgram'  and cta.Route !='NA' AND TimeIn IS NOT NULL AND TimeOut IS NOT NULL AND EntryUser IS NOT NULL

0 个答案:

没有答案