create new column based on specific values another columns – Postgresql
Let say I have this kind of column create table exercise (cust_id varchar, policy_id varchar, end_date date, flag varchar); insert into exercise (cust_id, policy_id, end_date, flag) values ('1', 'a1', '2022-10-12', 'inactive'), ('1', 'a2', '2022-10-20', 'inactive'), ('1', 'a2', '2023-05-15', 'active'), ('2',…