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
raysfdc1988raysfdc1988 

how to get parent id from custom object

Account-->Contact-->Attendance_Record

Here How to get account id in SOQL ...Pl help
 I tried like this but getting Error
select id from account where id in:(select id,AccountId from Contact where id in:(SELECT Contact__c FROM Attendance_Record__c))
lakslaks
Hi,

Since AccountId is there in Contact object itself you wouldn't have to go back three levels.

The following should work ->
SELECT Id, AccountID from Contact where Id in (SELECT Contact__c FROM Attendance_Record__c)

The ':' after in is not required.

Kindly mark it as the Solution if it solved your issue.

Regards,
Lakshmi.