sql - MySQL 5.7 GENERATED ALWAYS column defined as subquery -
i can't seem find issue query. have 4 tables:
agency_infoequipment_takenequipment_weightmission_overview
in mission_overview column totalweightinkg, want calculated selecting equipment_taken.qty (which int), , equipment_weight.equipweightinkg (which float), , multiply them.
so far have column definition:
float generated (select qty, equpweightinkg, (qty*equpweightinkg) totalweightinkg equipment_taken, equipment_weight) stored ; i can't head around it... read documentation on select queries , joins still can't seem come right query...
https://dev.mysql.com/doc/refman/5.7/en/create-table-generated-columns.html says:
subqueries, parameters, variables, stored functions, , user-defined functions not permitted.
to you're trying do, you'll have write triggers before insert , before update query other tables , populate float column.
Comments
Post a Comment