Following are the queries you can use,
- Run the below query to get the required address attribute id values,
select * from eav_attribute where entity_type_id=2 and is_required=1;
- Use the attribute_id from the last query, and use it in the corresponding backend_type tables,
query 1 >> select entity_id from customer_address_entity_varchar where attribute_id in (20,22,26,27,30,31) and value is NULL;
query 2 >> select entity_id from customer_address_entity_text where attribute_id in (25) and value is NULL;
This queries will give the customer entity_id values who are all have empty required field values.
- Use the comma separated entity_id values in the following delete quires,
delete from customer_address_entity_varchar where entity_id in (>result from query 1<) and attribute_id in (20,22,26,27,30,31);
delete from customer_address_entity_text where entity_id in (>result from query 2<) and attribute_id in (25);
- These delete quires will delete the empty required address fields of the customer. To delete all the address fields for the customer you can pick the attribute_id from
eav_attribute
using,
select * from eav_attribute where entity_type_id=2;