2017-10-17 54 views
0

我想要SQL或表關係來找出在magento中做出特定訂單的客戶的性別。在magento中訂購的客戶的性別

+0

怎麼樣 '選擇customer_prefix FROM sales_flat_order WHERE increment_id = 「100000XXXX」;'' –

+0

列customer_prefix'爲空。有沒有其他方法可以從客戶性別中獲取? – Dilani

回答

0

在我的數據庫,它是:

SELECT t0.entity_id, t1.value 
FROM customer_entity AS t0 
INNER JOIN (
    SELECT t2.entity_id, t2.value 
    FROM customer_entity_int AS t2 
    WHERE (t2.attribute_id = 18) 
) AS t1 
    ON (t0.entity_id = t1.entity_id) 

attribute_id = 18可能會有所不同。

你需要找到它:

SELECT t1.attribute_id, t1.attribute_code, t1.backend_type 
FROM eav_entity_type AS t0 
INNER JOIN eav_attribute AS t1 
    ON (t0.entity_type_id = t1.entity_type_id) 
WHERE (t0.entity_model = @p0) 
-- p0 = [customer/customer]