Jump to content

Export CSV Clients avec adresses postale et Custom Fields par Gestionnaire SQL


Recommended Posts

Bonjour,

Je cherche le moyen d'exporter la liste des clients avec leur adresse postale et les champs du module Custom Fields.

En effet je parviens à exporter dans le Gestionnaire SQL la requète basée sur le filtrage des clients sur un des champ personnalisé du module Custom Fields mais j'aimerai en plus y ajouter l'adresse postale du client ...

par exemple voici une requète :


SELECT
a.`id_customer`, `firstname`, `lastname`, `email`, `company`, a.`active` AS `active`, `newsletter`, `optin`, ccfv_14.`value` AS `ccfv_14_value`
        a.date_add, gl.name as title, (
            SELECT SUM(total_paid_real / conversion_rate)
            FROM mabdd_orders o
            WHERE o.id_customer = a.id_customer
             AND o.id_shop IN (1) 
            AND o.valid = 1
        ) as total_spent, (
            SELECT c.date_add FROM mabdd_guest g
            LEFT JOIN mabdd_connections c ON c.id_guest = g.id_guest
            WHERE g.id_customer = a.id_customer
            ORDER BY c.date_add DESC
            LIMIT 1
        ) as connect, ccfv_1.value AS ccfv_1_value, ccfv_7.value AS ccfv_7_value, ccfv_10.value AS ccfv_10_value, ccfv_11.value AS ccfv_11_value, ccfv_4.value AS ccfv_4_value, ccfv_5.value AS ccfv_5_value, ccfv_13.value AS ccfv_13_value, ccfv_14.value AS ccfv_14_value
FROM `mabdd_customer` a 
 
LEFT JOIN mabdd_gender_lang gl ON (a.id_gender = gl.id_gender AND gl.id_lang = 1)
LEFT JOIN mabdd_customer_custom_field_value ccfv_1
ON (a.id_customer = ccfv_1.id_customer AND ccfv_1.id_custom_field = 1)
 
LEFT JOIN mabdd_customer_custom_field_value ccfv_7
ON (a.id_customer = ccfv_7.id_customer AND ccfv_7.id_custom_field = 7)
 
LEFT JOIN mabdd_customer_custom_field_value ccfv_10
ON (a.id_customer = ccfv_10.id_customer AND ccfv_10.id_custom_field = 10)
 
LEFT JOIN mabdd_customer_custom_field_value ccfv_11
ON (a.id_customer = ccfv_11.id_customer AND ccfv_11.id_custom_field = 11)
 
LEFT JOIN mabdd_customer_custom_field_value ccfv_4
ON (a.id_customer = ccfv_4.id_customer AND ccfv_4.id_custom_field = 4)
 
LEFT JOIN mabdd_customer_custom_field_value ccfv_5
ON (a.id_customer = ccfv_5.id_customer AND ccfv_5.id_custom_field = 5)
 
LEFT JOIN mabdd_customer_custom_field_value ccfv_13
ON (a.id_customer = ccfv_13.id_customer AND ccfv_13.id_custom_field = 13)
 
LEFT JOIN mabdd_customer_custom_field_value ccfv_14
ON (a.id_customer = ccfv_14.id_customer AND ccfv_14.id_custom_field = 14)
 
WHERE 1  AND a.`deleted` = 0  AND ccfv_4.`value` LIKE '%2016%'  AND ccfv_4.`value` LIKE '%2016%' 
 
ORDER BY `date_add` DESC

 

Merci par avance pour votre aide

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...