As far as I know, MAX only returns the greatest row, so what you really want at the end is
WHERE table_tmp.id=table2.id AND table2.timestamp=MAX(table2.timestamp)


~MJI

Roy Walker wrote:
Still having a problem with this. Still have one last thing that isn't working. This is MySQL 4.0.13.

UPDATE table_tmp,table2_daily SET table_tmp.period_count = table_tmp.count - table2.count WHERE table_tmp.id = table2.id AND MAX(table2.timestamp);

This is giving me: ERROR 1111: Invalid use of group function.

I am trying to update the period_count field for all the records in table_tmp, by setting the equal to the count from table_tmp MINUS the count from table2 where the id's match and it is the newest record in table2.

Any ideas?
Please don't tell me to how to do it 4.1!  Please! :)

Roy



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



Reply via email to