Query comparing dates in SQL

前端 未结 7 1878
野趣味
野趣味 2020-11-28 10:18

I have a table with dates that all happened in the month November. I wrote this query

select id,numbers_from,created_date,amount_numbers,SMS_text 
from Tes         


        
7条回答
  •  孤独总比滥情好
    2020-11-28 10:53

    If You are comparing only with the date vale, then converting it to date (not datetime) will work

    select id,numbers_from,created_date,amount_numbers,SMS_text 
     from Test_Table
     where 
     created_date <= convert(date,'2013-04-12',102)
    

    This conversion is also applicable during using GetDate() function

提交回复
热议问题