@goutham-M , listing all loans which have a particular charge can be a very expensive operation. All you are interested in is seeing if there exists any loan which is linked to this charge. Please optimize the query....