· 7 years ago · Sep 03, 2018, 12:12 PM
1How to create a mysql view with current information
2CREATE VIEW activeProducts AS SELECT * FROM products WHERE isActive = 1
3
4SELECT * FROM products WHERE isActive = 1
5
6create table if not exists snapshot_table like regular_table;
7begin;
8 delete from snapshot_table;
9 insert into snapshot_table select * from regular_table where isActive = 1;
10commit;