I'm using the following SQL query:
select
FilteredSystemUser.systemuserid,
FilteredPhoneCall.regardingobjectid
from
FilteredPhoneCall
Inner Join
FilteredSystemUser on FilteredSystemUser.systemuserid in (FilteredPhoneCall.createdby)
Inner Join
FilteredLead on FilteredLead.leadid = FilteredPhoneCall.regardingobjectid
where
DateDiff(d, FilteredPhoneCall.createdon, GETDATE()) = 0
and FilteredLead.statecode = 0
and FilteredLead.ownerid = FilteredSystemUser.systemuserid
and FilteredPhoneCall.statecode = '1'
and FilteredPhoneCall.regardingobjecttypecode = 4
and FilteredPhoneCall.createdby in ('c2dd1ddc-0374-e611-80dc-00155d3d1992', '53cfbe3a-a09a-e611-80df-00155dce24d0')
and get the following output
Here I have two entries in regardingid 97C29D24-BEE2-E611-80F1-00155DCE24EF,091B1CAB-C2E2-E611-80F1-00155DCE24EF against same system user.so i need to consider this as single entry and get the count other than this the both system users having another two ids.