MySQL Forums
Forum List  »  Newbie

(Expiring Next Month) Problem
Posted by: Jassm Rahma
Date: August 12, 2014 01:44AM

Hi,

I have expiry_date field. I am using nthis code to get expired this month list.

SELECT contracts.contract_id, contract_types.type_name, contracts.contract_name, contracts.supplier, contracts.contact_name, contracts.contact_number, contracts.expiry_date, contracts.reminder FROM contracts
JOIN contract_types ON contract_types.type_id = contracts.type
WHERE MONTH(contracts.expiry_date) = MONTH(NOW()) AND YEAR(contracts.expiry_date) = YEAR(NOW());

Now, I would like to get list of expiring next month. How can I do this? what if current month is 12? then Next Month will be 1 and Year will also be changed?

Kindly advise

Options: ReplyQuote


Subject
Written By
Posted
(Expiring Next Month) Problem
August 12, 2014 01:44AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.