Home > Net >  How to fetch record where condition is current date 7 must be equal to some column date value
How to fetch record where condition is current date 7 must be equal to some column date value

Time:02-23

could you please help me to write query for below condition, i want to fetch record which meet the condition like (current date 7) must be equal to sdate. Ex:- suppose current date is 2022-02-23, then row 1 and row 4 should come. suppose current date is 2022-02-25, then row 2 should come.

WB.DATA table

PERIOD HSID SDATE START
2022-09-15 184 2022-03-03 N
2022-09-15 184 2022-03-05 Y
2022-09-15 183 2022-01-06 N
2022-09-15 183 2022-03-03 Y

CodePudding user response:

You may use:

SELECT *
FROM yourTable
WHERE SDATE = CURRENT DATE   7 DAYS;

CodePudding user response:

Try this

SELECT * FROM {tablename} WHERE SDATE = (NOW()   INTERVAL 7 DAY)
  • Related