I have the following table named 'product'
product_id (BIGINT) | product_name (VARCHAR) | expiration_date (DATE) | entered_date (DATETIME) |
1234 | ABC | NULL | 2013-07-24 13:17:32 |
6789 | ABC | NULL | 2013-07-19 12:04:12 |
1234 | ABC | NULL | 2013-07-05 13:34:16 |
2343 | ABC | NULL | 2013-06-04 17:16:51 |
I would like to update the expiration_date entries based on the eneterd_date column. If entered_date + 30 days > NOW(), then set the expiration_date = 30 days ahead else expiration_date = 60 days ahead
product_id (BIGINT) | product_name (VARCHAR) | expiration_date (DATE) | entered_date (DATETIME) |
1234 | ABC | 2013-08-24 | 2013-07-24 13:17:32 |
6789 | ABC | 2013-08-19 | 2013-07-19 12:04:12 |
1234 | ABC | 2013-08-05 | 2013-06-05 13:34:16 |
2343 | ABC | 2013-08-24 | 2013-06-04 17:16:51 |
I am trying my hands on ADDDATE() and other date functions in MySql but dint't have any good luck so far.
Please let me know you could help me out in getting the following result.
enter code here