Mike,
Is the field <days> meant to be the number of days until <expdate>?
(This is implied by the number 14 you gave). If so, you shouldn't be
storing the days value in the database at all (the reason being it
causes exactly the problem you seem to have). 

Instead you should store only expdate and then calculate the number of
days to expiry in a query like this:
select (to_days(expdate) - to_days(curdate()) as days_to_expire from
xxx...; If you get a negative answer then the record has already past
it's expiry date.

If I've misunderstood then sorry, please try again.
Regards,
Andy.

Mike Blezien wrote:
> 
> Hello,
> 
> I need to update one of our mysql tables, which has about 60,000 entires and
> correct the amount of days remain on each data record. An example of one of the
> data entires is:
> memid    days    regdate      expdate
> --------------------------------------
> 625290 |  5   | 2003-07-15  | 2003-08-16
> 
> now the days should be 14 and not 5 days. I have been trying to update the table
> with a single SQL query but haven't come up with a way to do this.. I'm sure
> it's something simple but I can't seem to come up with it. What is the best way
> to accomplish this in a single query to update the entire table so all the
> "days" are accurate according to the "expdate", and change the "days" so they
> are correct ??
> 
> thx's
> --
> Mike<mickalo>Blezien
> =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
> Thunder Rain Internet Publishing
> Providing Internet Solutions that work!
> http://www.thunder-rain.com
> Web Hosting
> http://www.justlightening.net
> Tel:  1(985)902-8484
> MSN: [EMAIL PROTECTED]
> =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
> 
> --
> MySQL General Mailing List
> For list archives: http://lists.mysql.com/mysql
> To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to