Two Ideas: First of all, the DATESTAMP datatype automatically updates it's datestamp with every modification to the row. You may want to use it to automatically update the time of your update. Also, you may want to look into using the TEMPORARY table type. Make a temporary table, fill it with the primary keys of the records you want to update by selecting into it from the main table, then iterate through those for processing, with the updates going to the main table.
Mike Hillyer -----Original Message----- From: Jeff Snoxell [mailto:[EMAIL PROTECTED]] Sent: Wednesday, December 18, 2002 1:54 PM To: [EMAIL PROTECTED] Subject: Re: Re: SELECT and UPDATE at the same time? >> >>SELECT * FROM my_table WHERE Age > 50 AND UPDATE Status = "OLD" > >No. That's goofy anyway. Why wouldn't you just use a regular >UPDATE query? > >UPDATE mytable Status = "OLD" WHERE Age > 50; Cos I want to do a fairly long-winded process on the records of those who are Age>50 and subsequently update all of their records with the Date/Time that the change took place. If I do the long-winded process and _then_ do the UPDATE query as you suggest I'm bound to update records which have been added in the meantime (by other clients, it's a busy database) which I've not yet processed. I could make a list of all primary key values I've processed and then update them... or something equally ugly. I just figured there'd be a cleaner way to do it. I really want to avoid grabbing all the results as my server is not located on my local machine. Oh, I could update all the records where age>50 with a known date/time then do my select query to select only those records with that "time-stamp", and then do my long-winded processing. Can't help thinking there must be a nicer way to do it. Thanks, Jeff --------------------------------------------------------------------- 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 --------------------------------------------------------------------- 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