Jump to content

Recommended Posts

Hello la communauté,

Je suis confronté à une erreur dans ma requête SQL (voir ci-dessous)

L'objectif de cette requête est de me lister l'ensemble des commandes (id_order) avec en face : prix vente + prix d'achat + quantité + date.

Ma requête fonctionne très bien jusqu'a ce que je fasse le left join pour récupérer les dates des commandes 

Pouvez-vous m'aider ?

Merci par avance ;)

#####

SELECT
id_order,
total_price_tax_incl,
purchase_supplier_price,
product_quantity
FROM ps_order_detail GROUP BY id_order

LEFT JOIN ps_orders ON ps_order_detail.id_order = ps_orders.id_order

Screenshot at Nov 09 17-52-02.png

Share this post


Link to post
Share on other sites

le Group By doit être en dernier dans ta requête et il manque des alias

SELECT
od.id_order,
od.total_price_tax_incl,
od.purchase_supplier_price,
od.product_quantity
FROM ps_order_detail od

LEFT JOIN ps_orders o ON od.id_order = o.id_order

GROUP BY od.id_order

Edited by Eolia (see edit history)

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...

Important Information

Cookies ensure the smooth running of our services. Using these, you accept the use of cookies. Learn More