Re: select and update field in one query

2004-06-28 Thread Michael Stassen
I'm assuming you want the rows with the top 1000 usage values. Why not just do it in 1 UPDATE statement? UPDATE yourtable SET checked = 1 ORDER BY usage DESC LIMIT 1000; This should work for any mysql 4.x.x, according to the manual . Michael Rhi

Re: select and update field in one query

2004-06-28 Thread SGreen
I would personally do it in three statements. The first one creates a temporary table from the results of the (SELECT) below. The second is the update with a JOIN to the temporary table. The third drops the temporary table. Doing it that way avoids the need to scroll through your recordset client-

Re: select and update field in one query

2004-06-28 Thread Rhino
- Original Message - From: "darren" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Monday, June 28, 2004 11:42 AM Subject: select and update field in one query > Hi all, > > I need to select the top 1000 records based on the "usage" field and update > the "checked" field to '1'. > >