Open Khandagale-Saurabh opened 2 years ago
offset from which position you want limit : how many you want
SubQuery 1] select id,name from Account where id in (Select AccountId from contact where phone !=null)
2]SELECT Id, Name, CreatedDate, (SELECT Name FROM Status_Historyr ORDER BY CreatedDate DESC LIMIT 1) FROM Service_Order__c WHERE id IN (SELECT id FROM Status_Historyr WHERE Name = 'Order Completed')
Child To parent Query: Select from Parent Record from child query: Eg: Select Name,Account.Name from Contact; Eg: select Name ,Department_r.Name from Employee_c;
Parent-to-child select Parent(child) from parent; Eg:SelectName,(Select Name from contact) from Account; Eg: Select Name,(Select Name from Employeer)from Departmentc;
List std=
[Select Name,(Select OwnerId,Name from Student_demor ) from Departmentc ];
for(Departmentc ss: std )
{
System.debug('Dep_Name '+ss.Name); // I am Parent data
if(ss.name.length()>=1)
{
//I am chid data
for(Student_democ ll:ss.Student_demo__r)
{
System.debug('==>>'+ll.name);
}
}
}