markA.Mtl Posted December 30, 2015 Share Posted December 30, 2015 Bonjour a tous Voila j ai besoin de votre aide j aimerai bien traduire cette requet SQL : select product_id,product_name, sum(product_quantity) as qty, sum(product_price) as price from ps_order_detail group by product_name order by product_price limit 10 a une requet qui peut etre execute sur prestashop dans mon module c a d sous le format : $this->_select = '...' pour pouvoir l'utiliser $this->fields_list Merci d avance Link to comment Share on other sites More sharing options...
markA.Mtl Posted December 31, 2015 Author Share Posted December 31, 2015 Voila ma solution que je partage avec vous : $this->_select = 'p.id_manufacturer as manufacturer ,m.name as name,o.date_add as date,product_name,sum(product_quantity) as qty,sum(product_price) as price';$this->_join = 'LEFT JOIN `'._DB_PREFIX_.'orders` o ON (o.`id_order` = a.`id_order`)LEFT JOIN `'._DB_PREFIX_.'product` p ON (p.`id_product` = a.`product_id`)LEFT JOIN `'._DB_PREFIX_.'manufacturer` m ON (p.`id_manufacturer` = m.`id_manufacturer`)';$this->_group = 'GROUP BY a.`product_name`';$this->_orderBy ='price';$this->_orderWay = 'DESC'; si il y a une autre solution mieux que la mienne je suis la pour la tester 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