You need to sign in to do that
Don't have an account?

question about parent-to child relationship in SOQL
Hi all,
I have the following SOQL (Just for example)
SELECT Account.Name, (SELECT Contact.FirstName, Contact.LastName FROM Account.Contacts where firstname='Mark') FROM Account
However, the result is : the clause where firstname='Mark' doesn't work.
why? if I want to get the result , that is , I want to find contact Mark's account name, what shall I do ?
This is my real SOQL in project :
select id ,owner.userrole.name , (select Overall_satisfaction__c from feedback__r where survey_received__c = last_week) from case where case.recordType.name != 'CRM4SRF' and case.recordType.name !='RFE' and case.owner.userrole.name ='APAC Support Services Engineer'
But I found survey_received__c = last_week , doesn' work!!
what do you mean it doesn't work, what does it do, and what were you expect it to do. The query should return all accounts, and all contacts at those accounts whose firstname is mark.

Hi Simon,
Thank you for your reply. As you said I expect the query return
The accounts, which all contacts at those accounts whose firstname is mark.
But the result is : it returned all accounts, but some of the contacts of the account whose firstname is not mark but null,
why ? I can not unerstand in this SOQL :
SELECT Account.Name, (SELECT Contact.FirstName, Contact.LastName FROM Account.Contacts where firstname='Mark') FROM Account
where firstname='Mark' does't work. In another words, if you set the where firstname = 'never existed people'
it can also return data.
why?
Can you show a specific example ?