Skip to content
Advertisement

Sql query to get row from date filled

I want to get data from training_course table where current date minus 5 days is equal to training_end_date. Training_end_date is my field in the table. Thanks

Advertisement

Answer

You seem to want:

select * 
from training_course 
where training_end_date = current_date - interval 5 day

Or, if your dates have time components, you maybe want:

select * 
from training_course 
where training_end_date >= current_date - interval 5 day and training_date < current_date - interval 4 day
User contributions licensed under: CC BY-SA
5 People found this is helpful
Advertisement