Hi Everyone,

Is there an easy way to update a field for the last record referenced by an ID number? 
where that ID number is used on multiple rows?

At the moment I am doing this which works:

CREATE TEMPORARY TABLE tmp_user ( SELECT user_id, MAX(last_updated) AS 
max_last_updated FROM employee GROUP BY user_id);
UPDATE tmp_user, employee SET picture='My Pic3' WHERE employee.user_id='19' AND 
last_updated=tmp_user.max_last_updated;

Where "user_id" is the user I wish to update, and "picture" is just a string (which 
will hold the filename for their picture).

But this just seems too complicated? So any thoughts?

I'm also using v4.0.18...

Yours Sincerely

Darran

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

Reply via email to