Subquery as generated column in mysql?
问题 Can I create a generated column in table A which sums up a column in table B with a tableA_id of the row in table A? Suppose I have a table of of families, and a table of children. I want a sum of the ages of the children for each family. ALTER TABLE people.families ADD COLUMN sumofages DECIMAL(10,2) GENERATED ALWAYS AS (SELECT SUM(age) FROM people.children WHERE family_id = people.families.id) STORED; ERROR 3102: Expression of generated column 'sumofages' contains a disallowed function. I