I have a table called Report Card Table. In that table there is colum called expiry date. I would like to know everybody who's card is expring in less than or equal to 90 days
ItsMe5247 0 Newbie Poster
Recommended Answers
Jump to Post— urtrivedi 276SELECT * FROM `report_card_table` WHERE expirydate>=current_date() and expiry_date<=date_add( current_date(),interval 3 month)
Jump to Post— peeyush.budhia 0Instead of using comparison operator (
>=) and logical operator (AND) you can use theBETWEENoperator.BETWEENoperator process the query fast as compare to comparison operator and logical operator. Use the following query to get your result.
SELECT * FROM report_card_table WHERE expirydate BETWEEN CURRENT_DATE() AND DATE_ADD(CURRENT_DATE(),INTERVAL 3 MONTH);
All 5 Replies
urtrivedi 276 Nearly a Posting Virtuoso
peeyush.budhia 0 Newbie Poster
ItsMe5247 0 Newbie Poster
ItsMe5247 0 Newbie Poster
urtrivedi 276 Nearly a Posting Virtuoso
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.