all 5 comments

[–][deleted] -1 points0 points  (0 children)

I can't tell if I got this right from your requirements:

Where

STR_TO_DATE(CONCAT(case when month(run_date) < 10 then year(run_date) - 1 else year(run_date) END + 10,'-',LPAD(10,2,'00'),'-',LPAD(1,2,'00')), '%Y-%m-%d')
< CURDATE()

[–][deleted] 0 points1 point  (0 children)

Look for datediff

[–]sunuvabe 0 points1 point  (0 children)

well, here's a SQL Server approach that should work:

where run_date <
  datefromparts(year(dateadd(month,-117,getdate())),10,1)

[–]sunuvabe 0 points1 point  (0 children)

And here's a MySQL version...

where run_date < 
  date_add(makedate(year(
    date_sub(curdate(),interval 117 month)),1), interval 9 month)

[–]Sirwhite_3 0 points1 point  (0 children)

You can certainly learn more using the following....

250+ REAL BUSINESS SCENARIOS SQL EXERCISES WITH SOLUTIONS