Home > database >  How to write Three days completed condition in sql
How to write Three days completed condition in sql

Time:10-26

I have a column in table (name - dInsertedDate) that contains date of employee data received. I need to show all details post three days of data received.

select * from tbl_Emp where convert(date,dInsertedDate  3, 105) <= convert(date,getdate(),105)

CodePudding user response:

you can do it like this:

select * from tbl_Emp where dinserted >= dateadd(day,-3,getdate())

CodePudding user response:

You can use DATEADD function in sql to add or subtract from date

DECLARE @Date datetime = DATEADD(DAY, -3, getdate())

select * from tbl_Emp where dInsertedDate >= @Date
  •  Tags:  
  • sql
  • Related