function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion 

Master-Detail Relation ship

I create 2 objects ,

one is "A" this is master object 

second is "B" this is detail object

              problem is standardcontroller="A" (master) , in visualforce i have to read the "B" (detail)  field  ?


                   is it possible ? if possible how? ,not possible how do this ?


You have to use controller extension.....your query might look like


select id,(select id from b__r)from a__c;


testres97, you can't query from a parent to a child or master to detail that way. Check here for more detail:


Am I missing something?

yes you can


SELECT Account.Name,(SELECT Contact.Name FROM contacts) FROM Account


Account parent, contact child


In this case


select id,(select id from b__r)from a__c;


b is child, a is parent....only thing is you have to use the plular of b object ...may be something like bs


select id,(select id from bs__r)from a__c;

Yep, apologies. I read your reply way to quickly and responded even more too quickly.
I will call from Visualforce page , not write any method or any query .
can write quey in visual force ?

Don't think its possible. You can go from child to parent without soql but not vice versa