How to query child to parent
This just an example on how the parent-child query works...
Ways of writing Parent - Child Queries for Standard Objects
Select Id, Name, (Select Id, LastName from Contacts where Lastname='Frank') from Account Select Id, LastName, Account.Name from Contact
Ways of writing Parent - Child Queries for Custom Objects
Select Id, Name, (Select Id, Name from Custom_Object2s__r) from Custom_Object1__c Select Id, Name, Custom_Object1__r.Name from Custom_Object2__c
Hope this might helps...
@Hemalatha paruchuri, That's k, I didn't understand your question either... hope you find your solution