Khandagale-Saurabh / Salesforce

1 stars 0 forks source link

SOQL #9

Open Khandagale-Saurabh opened 2 years ago

Khandagale-Saurabh commented 2 years ago

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); } }

}

image image image

image image

Khandagale-Saurabh commented 1 year ago
image image

offset from which position you want limit : how many you want

image
Khandagale-Saurabh commented 7 months ago

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')

Khandagale-Saurabh commented 3 months ago

image

image

https://www.youtube.com/watch?v=IrN4jAOe0Uc