Hello everyone, when working with a view in mysql, I encountered the following situation: I created a table:
CREATE TABLE IF NOT EXISTS schema.table( row_id INT(255) NOT NULL AUTO_INCREMENT PRIMARY KEY, val1 DOUBLE, val2 DOUBLE, val3 DOUBLE); In val1 and val2 mediated arbitrary data, val3 filled in only one line:
INSERT INTO schema.table (va1, val2) VALUES (1, 2); INSERT INTO schema.table (va1, val2) VALUES (3, 4); INSERT INTO schema.table (va1, val2) VALUES (5, 6); And created a view based on this table:
CREATE OR REPLACE VIEW test_VIEW AS select t1.row_id as row_id, if (t1.val3 is null, SUM(t1.val1 + t1.val2) OVER(), t1.val3) AS val3 from test t1 The problem itself - how to save the calculated view value from val3 to a table in val3?