Comparing results with today's date?

前端 未结 10 1700
情深已故
情深已故 2020-12-08 09:15

Is there a way to use the Now() function in SQL to select values with today\'s date?

I was under the impression Now() would contain the ti

10条回答
  •  -上瘾入骨i
    2020-12-08 09:41

    If you have a table with just a stored date (no time) and want to get those by "now", then you can do this:

    SELECT * FROM tbl WHERE DATEDIFF(d, yourdate, GETDATE())=0
    

    This results in rows which day difference is 0 (so today).

提交回复
热议问题