Is it possible to compare the Child and Parent field values in a Single SOQL Relationship Query ?
say get me all contacts for an account which doesn't have same name as its parent account.
SELECT Contact.Id, Contact.Name, Account.Id, Account.Name
WHERE Account.Id = 'xxxxxxxxxxx' AND
Contact.Name <> Account.Name
or get me all opportunities for an account which has same LeadSource as Account
SELECT Id, LeadSource, Account.LeadSource
WHERE AccountId in : accIdSet AND
LeadSource <> Account.LeadSource