I have a table with some fields and a timestamp field! I want to update some fields from some rows but not the timestamp field which changes automatically.
UPDATE cars SET offer='No' WHERE registerdate<='20060615120000';
I was thinking of setting also the registerdate again by passing the previous values again but it is difficult to get a list of their current values and pass them with many update queries one by one
Someone says that by setting the field with its value doesn't change
if you need to use an UPDATE query but don't want
your timestamp columns to be automagically
updated as well just be sure to set them to
themselves in the SQL statement like so ...
UPDATE `table` SET `views` = `views`+1 ,
`timestamp` = `timestamp` WHERE `row_id`
= "242"
that way the the updates will take place but the
timestamps will not update themselves.
Hope it helps someone.
-=PJK=-
I tried
UPDATE cars SET offer='No', `registerdate`=`registerdate` WHERE registerdate<='$20060615120000';
but i get an error
Any ideas?
Last edited by dimitris on Mon Jul 17, 2006 4:36 am, edited 1 time in total.
Ok, on older servers I guess one would have to modify all the queries to take that into account like in your example, or just use more than 1 timestamp field so that it doesn't matter if it gets updated.. neither of which sound very fun..