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

Recommended Answers

All 2 Replies

select * from users where to_days(exp_date) - to_days(now()) = 7

that was so quick and so easy, smantscheff

thanks, should say, you are a life saver.

thanks again

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, learning, and sharing knowledge.