Compare DATETIME and DATE ignoring time portion

前端 未结 5 2415
清酒与你
清酒与你 2020-11-27 03:13

I have two tables where column [date] is type of DATETIME2(0).

I have to compare two records only by theirs Date parts (day+month+year), di

5条回答
  •  醉梦人生
    2020-11-27 03:32

    For Compare two date like MM/DD/YYYY to MM/DD/YYYY . Remember First thing column type of Field must be dateTime. Example : columnName : payment_date dataType : DateTime .

    after that you can easily compare it. Query is :

    select  *  from demo_date where date >= '3/1/2015' and date <=  '3/31/2015'.
    

    It very simple ...... It tested it.....

提交回复
热议问题