I'm trying to create a log of an inventory that runs daily
Basically on my log table i want to sum how many units have status1, how many units have status2, etc for every day
is there a way to fill up my log table without having to do it manually every day?
My log table is id serial, date date, count_of_status1 integer, count_of_status2 integer
My insert query would be
insert into logtable(date, count_of_status1, count_of_status2) select now(), count(*) filter (where status =1), count(*) filter (where status = 2) from mytable
How to make this insert to be done daily in an automated form rather than manually?