I am developing sql script to get CSR basic information and Login Logout details of CSR w.r.t Date. I am joining Resource table and AgentStateDetail on basis of ResourceID. Stats are coming fine. But agents whose "resourceid" changes frequently (new skills were added continuously) are missing in the result set.
AgentA has resourceid=1001 on 1st Jan 2022
AgentA has changed resourceid=1030 on 3rd Jan 2022. ( previous entry of id1001 is set active='f' )
This change in ResourceID of same Resource with same extension, leads to missing statistics in my custom script.
Please advise what more conditions may i add in custom query join to handle the missing stats.