Hi,
I am developing a database for Lease management system, I have a field expire date of Lease agreement in my database.
Now if expiry date is 07-December-2009
I need alert about it 3 months ago means today.
So how I can write SQL Query for this purpose.
thanks in advance...
ayesha789 7 Posting Pro in Training
Recommended Answers
Jump to PostI dont think you need to query a date 3 months ago, you need to find dates three months from now
strtotime() function
bogus brain dead almost code$dateone=strtotime(now +3 month); $datetwo=strtotime(now +4 month); $result=mysql_query('select * from table where expiry > %s and expiry < %s, …
Jump to PostI dont think you need to query a date 3 months ago, you need to find dates three months from now
strtotime() function
bogus brain dead almost code$dateone=strtotime(now +3 month); $datetwo=strtotime(now +4 month); $result=mysql_query('select * from table where expiry > %s and expiry < %s, $dateone $datetwo');
as …
Jump to PostUse Date Time functions,
select * from test where tdate=(current_date() - INTERVAL 3 MONTH);
Jump to PostTry this,
$result = mysql_query("SELECT * FROM lease_center WHERE LAPeriodEnd=(current_date() - INTERVAL 3 MONTH))"); if($result) { while($row = mysql_fetch_array($result)) { .... } }
Jump to PostUse >= or <= operator instead of =.
All 21 Replies
almostbob 866 Retired: passive income ROCKS
ayesha789 7 Posting Pro in Training
almostbob 866 Retired: passive income ROCKS
ayesha789 7 Posting Pro in Training
digital-ether 399 Nearly a Posting Virtuoso Team Colleague
almostbob 866 Retired: passive income ROCKS
ayesha789 7 Posting Pro in Training
almostbob 866 Retired: passive income ROCKS
ayesha789 7 Posting Pro in Training
ayesha789 7 Posting Pro in Training
ayesha789 7 Posting Pro in Training
almostbob 866 Retired: passive income ROCKS
kvprajapati 1,826 Posting Genius Team Colleague
ayesha789 7 Posting Pro in Training
ayesha789 7 Posting Pro in Training
kvprajapati 1,826 Posting Genius Team Colleague
ayesha789 7 Posting Pro in Training
kvprajapati 1,826 Posting Genius Team Colleague
ayesha789 7 Posting Pro in Training
ayesha789 7 Posting Pro in Training
ayesha789 7 Posting Pro in Training
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.