How to select Overdue Rows with Date Frequencies? +------------------------+--------+
|  Invoice_id | due_date | amount |
+-------------+----------+--------+
|  20         |2020-01-18|  1250  |
+-------------+----------+--------+
| 21          |2020-01-15|  1335  |
+-------------+----------+--------+


Get all Records with date passed n days and its multiple serires
like below...

for example n=5

SELECT * FROM `invoices` 
WHERE `due_date = DATE_ADD(CURDATE() + INTERVAL 5 days)
OR due_date = DATE_ADD(CURDATE() + INTERVAL 10 days)
OR due_date = DATE_ADD(CURDATE() + INTERVAL 15 days)`


but i want to make it universal for any n value


  Note: mySQL version in my machine is 5.*
WITH RECURSIVE
cte AS 
( SELECT @starting_deviation num
  UNION ALL
  SELECT num + @delta_deviation
  FROM cte 
  WHERE num &lt; @final_deviation )
SELECT * 
FROM invoices
JOIN cte ON invoices.due_date = CURRENT_DATE + INTERVAL cte.num DAY


For the query from the question @starting_deviation := 5, @delta_deviation := 5 and @final_deviation := 15. These values may be specified literally (inserted immediately into the query instead of variables), transferred via variables values assignement or taken from some service table.



In MySQL 5+ you must generate the numbers table in a subquery or use external static numbers table.

SELECT * 
FROM invoices
JOIN ( SELECT 5 num UNION ALL
       SELECT 10 UNION ALL
       SELECT 15 ) cte ON invoices.due_date = CURRENT_DATE + INTERVAL cte.num DAY



  i want to add is my frequency is not upto 3 series. it can be more than 3 maybe any number.... so for example if n is 5 and i want 10 frquesnces means 5,10, 15, 20......, 50


Use numbers generator. For example it can be (shown generator may give up to 64 values):

SELECT * 
FROM invoices
JOIN ( SELECT 5 * (1 + t1.num + t2.num * 4 + t3.num + 16) num
       FROM (SELECT 0 num UNION ALL SELECT 1 UNION ALL SELECT 2 UNION ALL SELECT 3) t1,
            (SELECT 0 num UNION ALL SELECT 1 UNION ALL SELECT 2 UNION ALL SELECT 3) t2,
            (SELECT 0 num UNION ALL SELECT 1 UNION ALL SELECT 2 UNION ALL SELECT 3) t3
     ) cte ON  invoices.due_date = CURRENT_DATE + INTERVAL cte.num DAY
WHERE cte.num BETWEEN 1 AND 10;