MS CRM SQL - Accounts with no Activities
select accountid, name, telephone1, revenue, numberofemployees, sic, new_siccodedescription, new_erpsystemname,
new_erpdescription, new_industryother, address1_name, address1_line1, address1_line2, address1_line3,
address1_city, address1_postalcode, address1_county, address1_country,
from filteredaccount a
where not exists (select regardingobjectid from FilteredActivityPointer c where c.regardingobjectid = a.accountid)
and statecode = 0
order by name
new_erpdescription, new_industryother, address1_name, address1_line1, address1_line2, address1_line3,
address1_city, address1_postalcode, address1_county, address1_country,
from filteredaccount a
where not exists (select regardingobjectid from FilteredActivityPointer c where c.regardingobjectid = a.accountid)
and statecode = 0
order by name