954,560 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

How to query exactly for exact date?

I am having a bit of difficulty in getting the right value.

What I want to query is, the users who expire in 7 days, for example on 4th Oct 2011, the query should display the result of that particular day only. Right now I am querying as below:

select * from users where exp_date between now() and adddate(now(), INTERVAL 7 DAY).

this query keep display till next 7 days.

But i want to show only for or on 7th day expiring clients as I move on to tomorrow's date then the today's displayed query should not display on tomorrow's display rather it show the expiring client on 5th Oct 2011 and so on.

How do I achieve this? please help

sammry
Light Poster
45 posts since Aug 2011
Reputation Points: 10
Solved Threads: 0
 
select * from users where to_days(exp_date) - to_days(now()) = 7
smantscheff
Nearly a Posting Virtuoso
1,233 posts since Oct 2010
Reputation Points: 300
Solved Threads: 254
 

that was so quick and so easy, smantscheff

thanks, should say, you are a life saver.

thanks again

sammry
Light Poster
45 posts since Aug 2011
Reputation Points: 10
Solved Threads: 0
 

This question has already been solved

Post: Markdown Syntax: Formatting Help
You
View similar articles that have also been tagged: