Jump to content

Besoin d'un coup de main sur requete


Recommended Posts

Bonjour à tous.

 

J'aurais besoin d'un petit coup de main sur une requete.

 

Mon objectif est de récupérer

  1. Le dernier panier d'un client pas commandé
SELECT * FROM (
	  SELECT c.id_cart, c.id_lang, cu.id_customer, cu.firstname, cu.lastname, cu.email, c.date_add
	  FROM ps_cart c
	    LEFT JOIN  ps_orders o ON ( o.id_cart = c.id_cart )
	    LEFT JOIN  ps_customer cu ON ( cu.id_customer = c.id_customer )
	    LEFT JOIN  ps_cart_product cp ON ( cp.id_cart = c.id_cart )
	  WHERE c.id_shop = 3
	    AND DATE_SUB(CURDATE(),INTERVAL 29 DAY) <= c.date_add AND DATE_SUB(CURDATE(),INTERVAL 28 DAY) >= c.date_add
	    AND cu.id_customer IS NOT NULL
	    AND cp.id_product IS NOT NULL
	    AND o.id_order IS NULL
	    ORDER BY c.id_cart DESC
) 
AS my_table_tmp
GROUP BY id_customer
ORDER BY id_cart DESC 

J'avais donc fait cela, mais le problème est que ca me recupère aussi des paniers, où le client a réaliser une commande ensuite.

 

 

 
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...