Hi Vishnu,
with the current set of Information it is hard to tell what you are looking for.
- Are you looking for an advice how the 4 named tables are linked?
- Are you looking on how to use "FOR ALL ENTRIES" in an SQL statement?
I think the first is already covered by the other posts.
On the second I want to give you the advice to think about a join, in many cases it is way more effective to do a join or use a range table instead of using the "FOR ALL ENTRIES" whcih basically creates a Loop... and Selecting a big bunch of data from huge tables like the ones you named is not a good idea if not needed ... and even worse in a loop.