Jump to content
  • 0

[SQL Snippet] Bestellungen bzw. Abverkäufe


Lausli

Question

Hey Leute,

 

ich habe mich mal diesbezüglich eingelesen aber komme nicht so wirklich weiter.

 

Ich habe dieses Snippet:

SELECT o.`id_order` AS `ID`,
    o.`reference` AS `Bestellnummer`,
	ROUND(o.`total_products_wt`,2) AS Gesamtpreis,
	p.`wholesale_price` AS `Einkaufspreis`,
    cu.`name` AS `Währung`,    

	c.`date_upd` AS `Datum`,

	c.`firstname` AS `Vorname`,
	c.`lastname` AS `Nachname`,
    ad.`address1` AS ` Empfängeradresse 1`,
    ad.`address2` AS ` Empfängeradresse 2`,
	ad.`postcode` AS `PLZ`,
    ad.`city` AS `Stadt`,
    st.`name` AS `Bundesland`,
    co.`name` AS `Land`,
    cou.`iso_code` AS `Landesvorwahl`,
    c.`email` AS `Kundenemail`,
    ad.`phone_mobile` AS `Kunde Handynummer`,

    p.`reference` AS `Artikel SKU`,
    d.`product_quantity` AS `Produkt-Menge`,
	o.`payment` AS `Zahlart`
	
	
FROM ps_orders o
    LEFT JOIN `ps_order_detail` d ON (o.id_order = d.id_order)
    LEFT JOIN `ps_customer` c ON (o.id_customer = c.id_customer)
    LEFT JOIN `ps_address` ad ON(o.`id_customer`=ad.`id_customer`)
    LEFT JOIN `ps_state` st ON(ad.`id_state`=st.`id_state`)
    LEFT JOIN `ps_country_lang` co ON(ad.`id_country`=co.`id_country`)
    LEFT JOIN `ps_country` cou ON(ad.`id_country`=cou.`id_country`)
    LEFT JOIN `ps_product` p ON(d.`product_id`=p.`id_product`)
    LEFT JOIN `ps_currency` cu ON(o.`id_currency`=cu.`id_currency`)
	
WHERE o.`valid` = 1
GROUP BY o.id_order,d.id_order_detail
ORDER BY o.`id_order`

mit dem ich meine Bestellungen exportiere. Aber, wenn ich die Summe der Gesamtbestellmengen addiere, dann komme ich auf eine Zahl, der ich nicht traue.

 

Nun will bzw. muss ich mal alle Eingänge viva PayPal und Konto prüfen was da bei raus kommt. Aber vielleicht kann mir ja mal jemand helfen bei diesem Problem, ob ich da im Snippet etwas falsch habe oder die Summe an sich passen kann.

 

Danke euch

Link to comment
Share on other sites

0 answers to this question

Recommended Posts

There have been no answers to this question yet

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