Is it possible to to compare the parent id of an account to another account? i.e.
SELECT Id from Account WHERE child_account.parentId = parent_account.Id;
I keep getting the 'Unknown Error parsing query' message from the Query Editor.
You cannot compare a field to another field in SOQL. The standard workaround is to use a formula. It's hard to tell what you're trying to achieve based on your syntax, but if you wanted to filter on records where one field equals another, you would do make a formula (say
DoesField1EqualField2__c) that looks like:
Field1__c = Field2__c
And then in your query, filter on that:
SELECT Id FROM Account WHERE DoesField1EqualField2__c = true
[SELECT Id from account where child_accountId = :parent_account];
Since both child account Id and Parent_account are on account object, you can compare. parent_account is a variable that holds parent account Id. It will be assigned as follows,
string parent_account = account.accountId;