This query is working fine for me but it is slow , it is fetching record from 2million records, Can you please guide me how can to remove these subqueries and convert it into jo