Why curdate() does not work for my query?
I would like to to find all softwares that are going to expire within the next 60 days.
The query should have returned 3 rows, not 2.
Here is the list of all records in my table:
mysql> select title, expiry_date from license;
+--------------------------+-------------+
| title | expiry_date |
+--------------------------+-------------+
| Microsoft Office | 2004-06-10 |
| Microsoft Visio | 2004-03-31 |
| RedHat Linux | 2004-04-10 |
| Oracle Enterprise Server | 2004-07-22 |
| Photoshop | 2004-05-05 |
+--------------------------+-------------+
5 rows in set (0.00 sec)
===========================================
And here is the query to find expiring / expired software
mysql> select title,expiry_date from license
-> where (expiry_date - curdate() ) <= 60;
+-----------------+-------------+
| title | expiry_date |
+-----------------+-------------+
| Microsoft Visio | 2004-03-31 |
| RedHat Linux | 2004-04-10 |
+-----------------+-------------+
2 rows in set (0.00 sec)
I would like to to find all softwares that are going to expire within the next 60 days.
The query should have returned 3 rows, not 2.
Here is the list of all records in my table:
mysql> select title, expiry_date from license;
+--------------------------+-------------+
| title | expiry_date |
+--------------------------+-------------+
| Microsoft Office | 2004-06-10 |
| Microsoft Visio | 2004-03-31 |
| RedHat Linux | 2004-04-10 |
| Oracle Enterprise Server | 2004-07-22 |
| Photoshop | 2004-05-05 |
+--------------------------+-------------+
5 rows in set (0.00 sec)
===========================================
And here is the query to find expiring / expired software
mysql> select title,expiry_date from license
-> where (expiry_date - curdate() ) <= 60;
+-----------------+-------------+
| title | expiry_date |
+-----------------+-------------+
| Microsoft Visio | 2004-03-31 |
| RedHat Linux | 2004-04-10 |
+-----------------+-------------+
2 rows in set (0.00 sec)