0

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

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

Executing:

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'

Marco
3,7205 gold badges25 silver badges31 bronze badges
asked May 8, 2017 at 14:18
3
  • What's the reasoning behind SUM(LENGTH())? Commented May 8, 2017 at 14:22
  • To get the size of of my blob column(file). Commented 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? Commented May 8, 2017 at 16:57

1 Answer 1

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

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

answered May 8, 2017 at 17:46

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

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

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.