with res as(select us.column,mg.column as status,count(mg.column) FROM Table_name1 it
LEFT JOIN Table_name2 us on it.column=us.column
LEFT JOIN Table_name3 mg on it.column=mg.column
where it.column is not null and it.column in(5,6) and (it.column + '05:30:00'::INTERVAL)::date between '2022-08-28' and '2022-10-03' group by us.column,mg.column)
select res.column,
(case when column='Open' then count end) as Open_status,
(case when column='Closed' then count end) as Closed_status
from res group by res.column,res.column,res.column
i need to solve the remove duplicate entry in column1 open and close when it open and close status count details show and when it close the open details show the particular person
2
Answers