SLOT4EVER Posted December 10, 2023 Share Posted December 10, 2023 Hola Tengo la siguiente SQL que vuelca los clientes con las categorías en las que han hecho alguna compra, lo cual me sirve para segmentar la BBDD para email marketing. Sin embargo ahora ya no me vuelca el campo Categorías, (aparece vacío) SAbéis por qué puede ser? El SQL es select c.id_customer, c.firstname, c.lastname, c.email, c.date_add as fechaalta, c.newsletter, (select count(o.id_order) as pedidos from ps_orders o where c.id_customer = o.id_customer) as numpedidos, REPLACE((select group_concat(DISTINCT cl.name) from ps_order_detail od, ps_product p, ps_category c, ps_category_lang cl, ps_category_product cp, ps_orders o where c.id_customer = o.id_customer and cp.id_product = od.product_id and cp.id_category = cl.id_category and cl.id_lang = 4 and od.id_order = o.id_order and p.id_product = od.product_id and cl.id_shop=1 and c.id_category = cl.id_category and c.id_parent = 4 group by c.id_customer),'ó','o') as categorias from ps_customer c where c.email not like '%marketplace%' group by c.id_customer Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now