The following SOQL query is designed to return CampaignMember information by associated Contact.Name. The first time the SOQL query is run, it returns a list where two subsets of the CampaignMembers is sorted in alphabetical order (i.e. 'A,B,C,D,A,B,C,D' instead of 'A,A,B,B,C,C'.
SELECT New_TFA_School__c, Name, Id, Status, Referral__c, CreatedDate, Lead.Name, Lead.Primary_City__c, Lead.Primary_State__c, Lead.Primary_Country__c, Lead.Phone, Lead.Email, Lead.Graduation_Year__c, Contact.Name, Contact.Undergrad_School_Name__c, Contact.Graduation_Year__c, Contact.Email, Contact.Phone, Contact.MailingCity, Contact.MailingState, Contact.MailingCountry FROM CampaignMember WHERE CampaignID IN (SELECT Id FROM Campaign WHERE Campaign.Name = '2015 Michigan Regional Conference') ORDER BY Contact.Name
After running the query again, or refreshing the grid in the developer console the results appear in the correct order. I've confirmed this behavior in the JSON output from an associated REST endpoint, so I know it's not just a display issue in the Developer Console. I can't figure out why the the SOQL query would behave inconsistently if the underlying data hasn't changed ?
ORDER BY Contact.LastName, Contact.FirstName
notName
. 2. Are there two Campaigns named "2015 Michigan Regional Conference"?