<div dir="ltr"><div class="gmail_default" style="font-family:arial,helvetica,sans-serif">Thanks for chiming in quick.</div><div class="gmail_default" style="font-family:arial,helvetica,sans-serif"><br></div><div class="gmail_default" style="font-family:arial,helvetica,sans-serif">My two cents...</div><div class="gmail_default" style="font-family:arial,helvetica,sans-serif"><br></div><div class="gmail_default" style="font-family:arial,helvetica,sans-serif">DELETE FROM might fail after truncating vtiger_crmentity</div><div class="gmail_default" style="font-family:arial,helvetica,sans-serif">TRUNCATE on data-table is better instead.</div><div><div dir="ltr" class="m_1951749056303050816gmail_signature" data-smartmail="gmail_signature"><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr">--</div><div dir="ltr"><span style="border-collapse:collapse;font-family:arial,sans-serif;font-size:13px"><a href="http://www.facebook.com/vtiger" style="color:rgb(0,0,204)" target="_blank">FB</a> I </span><a href="http://twitter.com/vtigercrm" style="color:rgb(0,0,204)" target="_blank">Twit</a> I <a href="https://www.linkedin.com/company/1270573?trk=tyah" style="color:rgb(0,0,204)" target="_blank">LIn</a> I <a href="https://blogs.vtiger.com" style="color:rgb(0,0,204)" target="_blank">Blog</a> I <a href="https://www.vtiger.com/" style="color:rgb(0,0,204)" target="_blank">Website</a></div></div></div></div></div></div></div></div></div></div></div><br></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Thu, Jun 27, 2019 at 7:47 PM VTE <<a href="mailto:support@vtexperts.com" target="_blank">support@vtexperts.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><br>
Start with:<br>
<br>
update vtiger_crmentity set deleted='1';<br>
truncate vtiger_crmentity;<br>
<br>
and run the below:<br>
<br>
### Delete<br>
<br>
<br>
DELETE FROM `vtiger_account` WHERE accountid NOT IN (SELECT crmid FROM<br>
vtiger_crmentity);<br>
DELETE FROM `vtiger_accountbillads` WHERE accountaddressid NOT IN (SELECT<br>
crmid FROM vtiger_crmentity);<br>
DELETE FROM `vtiger_accountscf` WHERE accountid NOT IN (SELECT crmid FROM<br>
vtiger_crmentity);<br>
DELETE FROM `vtiger_accountshipads` WHERE accountaddressid NOT IN (SELECT<br>
crmid FROM vtiger_crmentity);<br>
<br>
### Contacts<br>
<br>
DELETE FROM `vtiger_contactaddress` WHERE contactaddressid NOT IN (SELECT<br>
crmid FROM vtiger_crmentity);<br>
DELETE FROM `vtiger_contactdetails` WHERE contactid NOT IN (SELECT crmid<br>
FROM vtiger_crmentity);<br>
DELETE FROM `vtiger_contactscf` WHERE contactid NOT IN (SELECT crmid FROM<br>
vtiger_crmentity);<br>
DELETE FROM `vtiger_contactsubdetails` WHERE contactsubscriptionid NOT IN<br>
(SELECT crmid FROM vtiger_crmentity);<br>
<br>
### Leads<br>
<br>
DELETE FROM `vtiger_leadsubdetails` WHERE leadsubscriptionid NOT IN (SELECT<br>
crmid FROM vtiger_crmentity);<br>
DELETE FROM `vtiger_leadaddress` WHERE leadaddressid NOT IN (SELECT crmid<br>
FROM vtiger_crmentity);<br>
DELETE FROM `vtiger_leadscf` WHERE leadid NOT IN (SELECT crmid FROM<br>
vtiger_crmentity);<br>
DELETE FROM `vtiger_leaddetails` WHERE leadid NOT IN (SELECT crmid FROM<br>
vtiger_crmentity);<br>
<br>
<br>
<br>
### Services<br>
DELETE FROM vtiger_service WHERE serviceid NOT IN (SELECT crmid FROM<br>
vtiger_crmentity);<br>
DELETE FROM vtiger_servicecf WHERE serviceid NOT IN (SELECT crmid FROM<br>
vtiger_crmentity);<br>
<br>
### products<br>
<br>
DELETE FROM vtiger_products WHERE productid NOT IN (SELECT crmid FROM<br>
vtiger_crmentity);<br>
DELETE FROM vtiger_productcf WHERE productid NOT IN (SELECT crmid FROM<br>
vtiger_crmentity);<br>
<br>
## sales orders<br>
DELETE FROM `vtiger_salesorder` WHERE salesorderid NOT IN (SELECT crmid FROM<br>
vtiger_crmentity);<br>
DELETE FROM `vtiger_salesordercf` WHERE salesorderid NOT IN (SELECT crmid<br>
FROM vtiger_crmentity);<br>
DELETE FROM `vtiger_sobillads` WHERE sobilladdressid NOT IN (SELECT crmid<br>
FROM vtiger_crmentity);<br>
DELETE FROM `vtiger_soshipads` WHERE soshipaddressid NOT IN (SELECT crmid<br>
FROM vtiger_crmentity);<br>
DELETE FROM `vtiger_inventoryproductrel` WHERE id NOT IN (SELECT crmid FROM<br>
vtiger_crmentity);<br>
<br>
### Activity<br>
<br>
DELETE FROM vtiger_activity WHERE activityid NOT IN (SELECT crmid FROM<br>
vtiger_crmentity);<br>
DELETE FROM `vtiger_activitycf` WHERE activityid NOT IN (SELECT crmid FROM<br>
vtiger_crmentity);<br>
DELETE FROM `vtiger_activity_reminder` WHERE activity_id NOT IN (SELECT<br>
crmid FROM vtiger_crmentity);<br>
DELETE FROM `vtiger_emaildetails` WHERE emailid NOT IN (SELECT crmid FROM<br>
vtiger_crmentity);<br>
<br>
<br>
#comments<br>
DELETE FROM vtiger_modcomments WHERE modcommentsid NOT IN (SELECT crmid FROM<br>
vtiger_crmentity);<br>
DELETE FROM `vtiger_modcommentscf` WHERE modcommentsid NOT IN (SELECT crmid<br>
FROM vtiger_crmentity);<br>
<br>
<br>
# assets<br>
<br>
DELETE FROM vtiger_assets WHERE assetsid NOT IN (SELECT crmid FROM<br>
vtiger_crmentity);<br>
DELETE FROM `vtiger_assetscf` WHERE assetsid NOT IN (SELECT crmid FROM<br>
vtiger_crmentity);<br>
<br>
# invoice<br>
DELETE FROM vtiger_invoice WHERE invoiceid NOT IN (SELECT crmid FROM<br>
vtiger_crmentity);<br>
DELETE FROM `vtiger_invoicecf` WHERE invoiceid NOT IN (SELECT crmid FROM<br>
vtiger_crmentity);<br>
<br>
# sc<br>
<br>
DELETE FROM vtiger_servicecontracts WHERE servicecontractsid NOT IN (SELECT<br>
crmid FROM vtiger_crmentity);<br>
DELETE FROM `vtiger_servicecontractscf` WHERE servicecontractsid NOT IN<br>
(SELECT crmid FROM vtiger_crmentity);<br>
<br>
# Oppts<br>
DELETE FROM vtiger_potential WHERE potentialid NOT IN (SELECT crmid FROM<br>
vtiger_crmentity);<br>
DELETE FROM vtiger_potentialscf WHERE potentialid NOT IN (SELECT crmid FROM<br>
vtiger_crmentity);<br>
<br>
# Leads<br>
DELETE FROM vtiger_leaddetails WHERE leadid NOT IN (SELECT crmid FROM<br>
vtiger_crmentity);<br>
DELETE FROM vtiger_leadsubdetails WHERE leadsubscriptionid NOT IN (SELECT<br>
crmid FROM vtiger_crmentity);<br>
DELETE FROM vtiger_leadaddress WHERE leadaddressid NOT IN (SELECT crmid FROM<br>
vtiger_crmentity);<br>
DELETE FROM vtiger_leadscf WHERE leadid NOT IN (SELECT crmid FROM<br>
vtiger_crmentity);<br>
<br>
# misc<br>
<br>
DELETE FROM vtiger_notes WHERE notesid NOT IN (SELECT crmid FROM<br>
vtiger_crmentity);<br>
DELETE FROM vtiger_troubletickets WHERE ticketid NOT IN (SELECT crmid FROM<br>
vtiger_crmentity);<br>
DELETE FROM vtiger_ticketcf WHERE ticketid NOT IN (SELECT crmid FROM<br>
vtiger_crmentity);<br>
DELETE FROM vtiger_products WHERE productid NOT IN (SELECT crmid FROM<br>
vtiger_crmentity);<br>
DELETE FROM vtiger_faq WHERE id NOT IN (SELECT crmid FROM vtiger_crmentity);<br>
DELETE FROM vtiger_activity WHERE activityid NOT IN (SELECT crmid FROM<br>
vtiger_crmentity);<br>
DELETE FROM vtiger_vendor WHERE vendorid NOT IN (SELECT crmid FROM<br>
vtiger_crmentity);<br>
DELETE FROM vtiger_pricebook WHERE pricebookid NOT IN (SELECT crmid FROM<br>
vtiger_crmentity);<br>
DELETE FROM vtiger_quotes WHERE quoteid NOT IN (SELECT crmid FROM<br>
vtiger_crmentity);<br>
DELETE FROM vtiger_account WHERE accountid NOT IN (SELECT crmid FROM<br>
vtiger_crmentity);<br>
DELETE FROM vtiger_purchaseorder WHERE purchaseorderid NOT IN (SELECT crmid<br>
FROM vtiger_crmentity);<br>
DELETE FROM vtiger_salesorder WHERE salesorderid NOT IN (SELECT crmid FROM<br>
vtiger_crmentity);<br>
DELETE FROM vtiger_account WHERE accountid NOT IN (SELECT crmid FROM<br>
vtiger_crmentity);<br>
DELETE FROM vtiger_invoice WHERE invoiceid NOT IN (SELECT crmid FROM<br>
vtiger_crmentity);<br>
DELETE FROM vtiger_invoicecf WHERE invoiceid NOT IN (SELECT crmid FROM<br>
vtiger_crmentity);<br>
DELETE FROM vtiger_campaign WHERE campaignid NOT IN (SELECT crmid FROM<br>
vtiger_crmentity);<br>
DELETE FROM vtiger_pbxmanager WHERE pbxmanagerid NOT IN (SELECT crmid FROM<br>
vtiger_crmentity);<br>
DELETE FROM vtiger_servicecontracts WHERE servicecontractsid NOT IN (SELECT<br>
crmid FROM vtiger_crmentity);<br>
DELETE FROM vtiger_servicecontractscf WHERE servicecontractsid NOT IN<br>
(SELECT crmid FROM vtiger_crmentity);<br>
DELETE FROM vtiger_service WHERE serviceid NOT IN (SELECT crmid FROM<br>
vtiger_crmentity);<br>
DELETE FROM vtiger_servicecf WHERE serviceid NOT IN (SELECT crmid FROM<br>
vtiger_crmentity);<br>
DELETE FROM vtiger_assets WHERE assetsid NOT IN (SELECT crmid FROM<br>
vtiger_crmentity);<br>
DELETE FROM vtiger_assetscf WHERE assetsid NOT IN (SELECT crmid FROM<br>
vtiger_crmentity);<br>
DELETE FROM vtiger_projectmilestone WHERE projectmilestoneid NOT IN (SELECT<br>
crmid FROM vtiger_crmentity);<br>
DELETE FROM vtiger_projectmilestonecf WHERE projectmilestoneid NOT IN<br>
(SELECT crmid FROM vtiger_crmentity);<br>
DELETE FROM vtiger_projecttask WHERE projecttaskid NOT IN (SELECT crmid FROM<br>
vtiger_crmentity);<br>
DELETE FROM vtiger_projecttaskcf WHERE projecttaskid NOT IN (SELECT crmid<br>
FROM vtiger_crmentity);<br>
DELETE FROM vtiger_project WHERE projectid NOT IN (SELECT crmid FROM<br>
vtiger_crmentity);<br>
DELETE FROM vtiger_projectcf WHERE projectid NOT IN (SELECT crmid FROM<br>
vtiger_crmentity);<br>
<br>
#custom<br>
<br>
DELETE FROM `vtiger_listings` WHERE listingsid NOT IN (SELECT crmid FROM<br>
vtiger_crmentity);<br>
DELETE FROM `vtiger_listingscf` WHERE listingsid NOT IN (SELECT crmid FROM<br>
vtiger_crmentity);<br>
<br>
<br>
<br>
<br>
<br>
-----<br>
VTExperts<br>
--<br>
Sent from: <a href="http://vtiger-crm.2324883.n4.nabble.com/vtigercrm-developers-f4.html" rel="noreferrer" target="_blank">http://vtiger-crm.2324883.n4.nabble.com/vtigercrm-developers-f4.html</a><br>
_______________________________________________<br>
<a href="http://www.vtiger.com/" rel="noreferrer" target="_blank">http://www.vtiger.com/</a><br>
</blockquote></div>