Generated Columns AVG of other columns
Posted by: James Butler
Date: August 11, 2020 03:31PM

Trying to define simple table with a generated column that contains an average of the other columns, but getting "Invalid use of group function"

TIA for any assistance.

mysql> create table scores (
-> id int,
-> c1 float(4) default 0.1,
-> c2 float(4) default 0.3,
-> c3 float(4) default 0.5,
-> score float(4) generated always as (avg(c1+c2+c3))
-> );
ERROR 1111 (HY000): Invalid use of group function

Options: ReplyQuote


Subject
Written By
Posted
Generated Columns AVG of other columns
August 11, 2020 03:31PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.