Blog

Main » 2016 » August » 09

Cascade of deletion:

  1. order line items
  2. orders
  3. contacts
  4. accounts

Accounts

Accounts no Contacts
select Id,name from Account where Id not In (select AccountId from Contact)

or

list<Account> s= [select Id,name from Account 
                  where 
                  Id not In (select AccountId from Contact)
                  AND Id not In (select AccountId from Case)
                  AND Id!='001E000000CaEySIAV' AND ID!='001E000001dOqGbIAK'
                  LIMIT 200];
delete s;

Contacts

Contacts (Basic filter)

Select Id FROM Contact WHERE ((LastName=' ... Read more »