MySQL Lists are EOL. Please join:

List:General Discussion« Previous MessageNext Message »
From:Michael Iatauro Date:July 15 2003 9:26pm
Subject:Re: Complex select statement
View as plain text  
As far as I know, MAX only returns the greatest row, so what you really 
want at the end is
WHERE AND table2.timestamp=MAX(table2.timestamp)


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 = 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

Complex select statementRoy Walker11 Jul
RE: Complex select statementRoy Walker11 Jul
  • Re: Complex select statementEgor Egorov11 Jul
  • Re: Complex select statementNils Valentin12 Jul
RE: Complex select statementRoy Walker11 Jul
RE: Complex select statementRudy Metzger14 Jul
RE: Complex select statementRoy Walker15 Jul
  • Re: Complex select statementMichael Iatauro15 Jul
RE: Complex select statementRoy Walker16 Jul
RE: Complex select statementRudy Metzger16 Jul