close ad
 
Important WebAssist Announcement
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

Advance date query

Thread began 3/21/2010 6:23 am by Gizza372666 | Last modified 3/22/2010 5:16 pm by Gizza372666 | 1101 views | 4 replies |

Gizza372666

Advance date query

Can you please let me know the command that will enable me to find all the customers WHERE contractEnds in the next 30 days?
Here is my current query:

------------------------------------------------
SELECT BusinessName, ContractStart, ContractEnd
FROM customers_tbl
WHERE ContractEnd <= 30
-------------------------------------------------
About the ContractEnd field: I use MySQL and the field is set as DATE
Year-Month-Day
0000-00-00
I will really appreciate your help.
Thanks

Sign in to reply to this post

Ray BorduinWebAssist

WHERE CURDATE() <= ContractEnd - INTERVAL 30 DAY

date-and-time-functions.html#function_date-add

Sign in to reply to this post
Did this help? Tips are appreciated...

Gizza372666

Fantastic!
Thank you so much.
One final question and I'll be extremely happy if you will be able to answer this question.
"SELECT * FROM customers_tbl WHERE CURDATE() >= ContractEnd - INTERVAL 30 DAY"

The above will let me know customers who have to renew their contract in less than 30 days and it will display all the records below the +30 days
So far very good

I will like to control this by stopping on -30 DAY.
So the records will be +30 and -30
At the moment it shows every single record below the +30 including contracts have ended in 2005

Is this possible?
You will be the best programming helper if you will be able to give me the answer.
Looking forward for the answer.
THANKS THANKS THANKS!!!

Sign in to reply to this post

Ray BorduinWebAssist

SELECT * FROM customers_tbl WHERE CURDATE() >= ContractEnd - INTERVAL 30 DAY AND CURDATE() <= ContractEnd + INTERVAL 30 DAY

Sign in to reply to this post
Did this help? Tips are appreciated...

Gizza372666

What a man
You are the best

Thank you very much

Sign in to reply to this post

Build websites with a little help from your friends

Your friends over here at WebAssist! These Dreamweaver extensions will assist you in building unlimited, custom websites.

Build websites from already-built web applications

These out-of-the-box solutions provide you proven, tested applications that can be up and running now.  Build a store, a gallery, or a web-based email solution.

Want your website pre-built and hosted?

Close Windowclose

Rate your experience or provide feedback on this page

Account or customer service questions?
Please user our contact form.

Need technical support?
Please visit support to ask a question

Content

rating

Layout

rating

Ease of use

rating

security code refresh image

We do not respond to comments submitted from this page directly, but we do read and analyze any feedback and will use it to help make your experience better in the future.

Close Windowclose

We were unable to retrieve the attached file

Close Windowclose

Attach and remove files

add attachmentAdd attachment
Close Windowclose

Enter the URL you would like to link to in your post

Close Windowclose

This is how you use right click RTF editing

Enable right click RTF editing option allows you to add html markup into your tutorial such as images, bulleted lists, files and more...

-- click to close --

Uploading file...