1

When I run

select count() from attachment ; it returns 3099 .

when I run

Select Name,Id,ParentId,Parent.Type,Owner.Name,Owner.Id ,Owner.IsActive ,ContentType,isPrivate from Attachment ; it return 3099

when I run

Select count(Parent.Type) from Attachment ; -- it return 3091

when I run

Select Name,Id,ParentId,Parent.Type,Owner.Name,Owner.Id ,Owner.IsActive ,ContentType,isPrivate from Attachment order by Parent.Type; it return 3050

I played with SOQL above today and I have no idea why it returns data count differently.Which one is accurate?

The aggregate value still return null but total count is different between select count() from attachment.

enter image description here

2 Answers 2

1

1st and 2nd query returns number of attachments, 3rd query is returning attachments having Parent.Type != null so you are getting count different

1
  • Attached picture it still return null, in my programming logic I put filter to get parent.Type=null and it returns 8 data.But still not match with total data.
    – unidha
    Commented Aug 24, 2016 at 11:47
0

After I digged the all the data return by select Id from Attachment, I found out the missing number is coming from Parent.type='00X' which are Unfiled Public Email Templates.

https://unidha-dev-ed.my.salesforce.com/00X?setupid=CommunicationTemplatesEmail&retURL=%2Fui%2Fsetup%2FSetup%3Fsetupid%3DCommunicationTemplates

However if we try to manually query it

Select Id from Attachment where Parent.Type='00X , it will return 0 data.

Also some of Parent.Type is null but actually it is 'Event'.

I hope they have documentation on this.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .