"[EMAIL PROTECTED]" wrote:
> 
> Hi,
> 
> small problem. I have a table set up like so. It has a number of entries
> that were added on a certain date, I use TIMESTAMP to keep track of the date.
> 
> +---------------------+---------------+------+-----+---------+--------------
> --+
> | Field               | Type          | Null | Key | Default | Extra
>   |
> +---------------------+---------------+------+-----+---------+--------------
> --+
> | auto                | mediumint(10) |      | PRI | NULL    |
> auto_increment |
> | accref              | varchar(6)    | YES  |     | NULL    |
>   |
> | orderdate           | timestamp(8)  | YES  |     | NULL    |
>   |
> | version             | varchar(9)    | YES  |     | NULL    |
>   |
> | upgradep            | varchar(4)    | YES  |     | NULL    |
>   |
> | status              | varchar(8)    | YES  |     | NULL    |
>   |
> | status_relate_to_id | int(11)       | YES  |     | NULL    |
>   |
> +---------------------+---------------+------+-----+---------+--------------
> --+
> 
> Unfortunately, I used this query on the table
> 
> mysql> UPDATE deerfield SET version = '2.1' WHERE product = 'WinGate LITE';
> 
> and all of the dates of the filed that match the where clause updated to
> today's date. How can I avoid this? Is there a problem with the set-up of
> the timestamp itself.
> 

That is the correct operation.  The manual says, "The TIMESTAMP column
type provides a type that you can use to automatically mark INSERT or
UPDATE operations with the current date and time. If you have multiple
TIMESTAMP columns, only the first one is updated automatically.", in
section 6.2.2.2.

You may want to use a DATETIME column type and use the NOW() function to
set it.

Jim

-- 
/"\   ASCII Ribbon Campaign  .
\ / - NO HTML/RTF in e-mail  .
 X  - NO Word docs in e-mail .
/ \ -----------------------------------------------------------------
[EMAIL PROTECTED]      http://www.FreeBSD.org     The Power to Serve
[EMAIL PROTECTED]  http://www.TheHousleys.net
[EMAIL PROTECTED]  http://www.SimTel.Net
---------------------------------------------------------------------
Hi! I'm a .signature virus! Copy me in your ~/.signature
to help me spread!             <- Save this lifeform ;-)

---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to