diff options
Diffstat (limited to 'opdracht-2/t6.sql')
-rw-r--r-- | opdracht-2/t6.sql | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/opdracht-2/t6.sql b/opdracht-2/t6.sql new file mode 100644 index 0000000..83eddf5 --- /dev/null +++ b/opdracht-2/t6.sql @@ -0,0 +1,10 @@ +select + `Order`.ID as OrderID, + concat("product ", Product.ID, ", ", OrderProduct.Aantal, " stuks") as OrderInhoud, + round(Product.Prijs * OrderProduct.Aantal, 2) as Subtotaal +from OrderProduct + left join `Order` on `Order`.ID = OrderProduct.OrderID + left join Klant on Klant.ID = `Order`.KlantID + left join Product on Product.ID = OrderProduct.ProductID +where Klant.ID = 1 +group by OrderProduct.ProductID, `Order`.ID; |