You need to sign in to do that
Don't have an account?
Anjali Sharma 87
Realationship Query on page
Hi
How to write the relationship query and how to fetch the record from the query on visaulforce page
For ex i have one account object and one contact obj then how to write the relationship from parent to child and child to parent bcoz when i am using the query it will give only id
Account con;
con = [select account.name,(Select contact.firstName,contact.lastName from account.contacts) from account limit 1];
system.debug(con);
how to fetch the value of contact.last name and same when i use child to parent ?????
And then how to to display it on visualforce page.
Please explain me!!!
How to write the relationship query and how to fetch the record from the query on visaulforce page
For ex i have one account object and one contact obj then how to write the relationship from parent to child and child to parent bcoz when i am using the query it will give only id
Account con;
con = [select account.name,(Select contact.firstName,contact.lastName from account.contacts) from account limit 1];
system.debug(con);
how to fetch the value of contact.last name and same when i use child to parent ?????
And then how to to display it on visualforce page.
Please explain me!!!
Apex Controller Visualforce Page:
All Answers
Apex Controller Visualforce Page:
List<Store__c> stlst ;
stlst = [Select Store_name__c,Store_num__c ,(Select Book_name__c,quntiy__c,Store__c from Books__r) from Store__c];
Books__r is the relationship name and store_name_c, store_num_c are master obj fileds and rest three belongs to child obj i.e store_c
Please help me!!!!