![]() |
|
|||||||
|
|
Thread Tools | Display Modes |
|
#1
IP: 121.234.209.73
|
|||
|
|||
|
I want to get rows for all customer details from magento tables.
Can anyone give me the query? Tables are: •customer_entity •eav_attribute •customer_entity_varchar' Answer A: Code:
SELECT `firstname`.`value` as `First_Name`, `surname`.`value` as `Surname`, `telephone`.`value` as `Telephone`, `customer_entity`.`created_at`, `customer_entity`.`updated_at` FROM `customer_address_entity_varchar` as `country` INNER JOIN `customer_address_entity_varchar` as `firstname` USING (`entity_id`) INNER JOIN `customer_address_entity_varchar` as `surname` USING (`entity_id`) INNER JOIN `customer_address_entity_varchar` as `telephone` USING (`entity_id`) INNER JOIN `customer_entity` USING (`entity_id`) WHERE `country`.`attribute_id` = 26 && `country`.`value`="GB" && `firstname`.`attribute_id` = 19 && `surname`.`attribute_id` = 21 && `telephone`.`attribute_id` = 30 && `telephone`.`value` LIKE "07%" GROUP BY `telephone`.`value` limit 0,10; useful code a: GROUP BY `customer_entity`.`email` Code:
SELECT `firstname`.`value` as `First_Name`, `surname`.`value` as `Surname`, `customer_entity`.`email` FROM `customer_address_entity_varchar` as `country` INNER JOIN `customer_address_entity_varchar` as `firstname` USING (`entity_id`) INNER JOIN `customer_address_entity_varchar` as `surname` USING (`entity_id`) INNER JOIN `customer_entity` USING (`entity_id`) WHERE `country`.`attribute_id` = 26 && `country`.`value`="US" && `firstname`.`attribute_id` = 19 && `surname`.`attribute_id` = 21 GROUP BY `customer_entity`.`email` limit 0,10; code b: GROUP BY `entity_id` Code:
SELECT `entity_id`, `firstname`.`value` as `First_Name`, `surname`.`value` as `Surname`, `customer_entity`.`email` FROM `customer_address_entity_varchar` as `country` INNER JOIN `customer_address_entity_varchar` as `firstname` USING (`entity_id`) INNER JOIN `customer_address_entity_varchar` as `surname` USING (`entity_id`) INNER JOIN `customer_entity` USING (`entity_id`) WHERE `country`.`attribute_id` = 26 && `country`.`value`="US" && `firstname`.`attribute_id` = 19 && `surname`.`attribute_id` = 21 GROUP BY `entity_id` limit 0,10; Code:
create table aaa_custoemr SELECT `entity_id`, `firstname`.`value` as `First_Name`, `surname`.`value` as `Surname`, `customer_entity`.`email` FROM `customer_address_entity_varchar` as `country` INNER JOIN `customer_address_entity_varchar` as `firstname` USING (`entity_id`) INNER JOIN `customer_address_entity_varchar` as `surname` USING (`entity_id`) INNER JOIN `customer_entity` USING (`entity_id`) WHERE `country`.`attribute_id` = 26 && `country`.`value`="US" && `firstname`.`attribute_id` = 19 && `surname`.`attribute_id` = 21 GROUP BY `entity_id` limit 0,10000; answer 01: create table dust select * from student;//用于复制前未创建新表dust的情况下 answer 02: insert into dust select * from student;//已经创建了新表dust的情况下 Last edited by topvip : 2012-12-01 at 09:55 PM |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| x-cart Template Editing Guide for 4.1.x | topvip | X-Cart | 0 | 2009-04-15 11:42 PM |
| Template Editing Guide for 4.1.x | topvip | X-Cart | 0 | 2009-03-10 08:12 AM |
| What are the Strongest Directories? | smiling | 网站链接开发 | 1 | 2007-07-28 09:26 PM |