i writing small java application when input customer id , click lookup should fetch details of customer magento database. working far returning id, email, firstname , last name address info (address, zip, county, country, phone) not correct. reason because entity_id values in 2 different tables mismatched.
the sql query :
select e.`entity_id` customer_id, e.`email` , v1.`value` first_name, v2.`value` last_name, v10.`value` address, v3.`value` zip, v4.`value` city, v6.`value` county, v7.`value` country, v5.`value` phone `ipw_customer_entity` e inner join `ipw_customer_entity_varchar` v1 on e.entity_id = v1.entity_id inner join `ipw_customer_entity_varchar` v2 on e.entity_id = v2.entity_id inner join `ipw_customer_address_entity_varchar` v3 on e.entity_id = v3.entity_id inner join `ipw_customer_address_entity_varchar` v4 on e.entity_id = v4.entity_id inner join `ipw_customer_address_entity_varchar` v5 on e.entity_id = v5.entity_id inner join `ipw_customer_address_entity_varchar` v6 on e.entity_id = v6.entity_id inner join `ipw_customer_address_entity_varchar` v7 on e.entity_id = v7.entity_id inner join `ipw_customer_address_entity_text` v10 on e.entity_id = v10.entity_id e.`entity_id` = 9 , v1.attribute_id = 5 , v2.attribute_id = 7 , v3.attribute_id = 30 , v4.attribute_id = 26 , v5.attribute_id = 31 , v6.attribute_id = 28 , v7.attribute_id = 27 , v10.attribute_id = 25
n.b. e.entity.id=9 value have set testing - application passes value input
i checked tables in more detail , found whilst entity_id value in 'ipw_customer_entity' table set 1 value, example 9, entity_id values in tables 'ipw_customer_address_entity_text' , 'ipw_customer_address_entity_varchar' have different value - record 11. there table 'ipw_customer_address_entity' has mapping of 2 entity_ids though fields parent_id being equal 'ipw_customer_address_entity.entity_id' , field entity_id being equal 'ipw_customer_address_entity_text.entity_id' , 'ipw_customer_address_entity_varchar.entity_id'
my question , how can change sql statement account mapping , make works , return correct address data first entity_id. entity_value equal customer number on magento admin makes sense use 1 input.