I need to fetch whole customer data from mysql by query.
I need to get data by entity_id.
I used query
SELECT `e`.* FROM `customer_entity` AS `e` WHERE (`e`.`entity_type_id` = '1');
but this is not giving me whole data of customer with his related attribute.
Best Answer
I don't know why you need it my query but here is what you can do.
Activate the sql query log.
Edit
/lib/Varien/Db/Adapter/Pdo/Mysql.php
and set the values for$_debug
and$_logAllQueries
totrue
. then create a custom script that just callsThen you should see in
var/debug/pdo_mysql.log
the queries that are executed.You will see some 'noise' queries but the last ones should be what you need.
Here is what I got:
The first query retrieves the attributes, the second one the data:
If you remove the bindings you end up with this:
and the query to retrieve all data:
replace
entity_id = 1
withe your customer id.but there is a catch. You have to now to find a way to map the results from the first select, the one that retrieves the attributes with the one that retrieves the values.