Trying to update the "size" column with the value of "file" column.

  set NEW.size=SUM(LENGTH(file));


UPDATE `table`.`library` SET `_by`='Danis555, Vovan244' WHERE `id`='20';

Operation failed: There was an error while applying the SQL script to the database.

ERROR 1111: 1111: Invalid use of group function SQL Statement: UPDATE table.library SET _by='Danis555, Vovan244' WHERE id='20'

  • What's the reasoning behind SUM(LENGTH())?
    – mustaccio
    May 8, 2017 at 14:22
  • To get the size of of my blob column(file). May 8, 2017 at 14:55
  • How many LENGTHs do you expect to be returned for one column in one row that you need to SUM them?
    – mustaccio
    May 8, 2017 at 16:57

1 Answer 1

SET NEW.size = LENGTH(OLD.file);

No SUM, since there is only one row.
Specify which file with OLD..

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.