UPDATE tblclients as cl
LEFT JOIN tblstates as st ON  cl.billing_state = st.state_name 
SET cl.billing_state_id = st.state_id
WHERE cl.billing_street != "" AND cl.billing_state_id = 0 ;

UPDATE tblcustomer_properties as cp
LEFT JOIN tblstates as st ON cp.state = st.state_name
SET cp.state_id = st.state_id
WHERE cp.street_1 != "" AND cp.state_id = 0 ;


UPDATE tblestimates
SET billing_country = 1 
WHERE billing_street != "" AND billing_country = 0;

UPDATE tblestimates
SET property_country = 1 
WHERE property_street != "" AND property_country = 0;

UPDATE tblinvoices
SET billing_country = 1 
WHERE billing_street != "" AND billing_country = 0;

UPDATE tblinvoices
SET property_country = 1 
WHERE property_street != "" AND property_country = 0;

UPDATE tblexpenses
SET property_country = 1 
WHERE property_street != "" AND property_country = 0;

UPDATE tblwork_orders
SET property_country = 1 
WHERE property_street != "" AND property_country = 0;

UPDATE tbljobs
SET property_country = 1 
WHERE property_street != "" AND property_country = 0;

UPDATE tblshopping_list
SET country = 1 
WHERE street_1 != "" AND country = 0;

UPDATE tblleads
SET country = 1 
WHERE address != "" AND country = 0;

UPDATE tblclients
SET billing_country = 1 
WHERE billing_street != "" AND billing_country = 0;

UPDATE tblcustomer_properties
SET country = 1 
WHERE street_1 != "" AND country = 0;



UPDATE tblpost_inspections
SET property_country = 1 
WHERE property_street != "" AND property_country = 'US';

UPDATE tblpost_inspections
SET property_country = 1 
WHERE property_street != "" AND property_country = 0;













