Round()

Alle Produkte mit gerundetem Preis, sortiert nach Preis.

      SELECT ProductName, ROUND(Price,0) AS „gerundeter Preis“ FROM Products ORDER BY Price
Round_Bsp1

Einnahmen pro Land mit Rundung auf 0.05:
     SELECT c.country, COUNT(o.orderid) AS Anzahl , ROUND(SUM(od.quantity*p.price*20))/20
     AS Einnahmen
                  FROM customers AS c
                  LEFT JOIN orders AS o ON o.customerid = c.customerid
                  LEFT JOIN orderdetails AS od ON od.orderid = o.orderid
                  LEFT JOIN products AS p ON p.productid = od.productid
                  GROUP BY c.country
                  ORDER BY Einnahmen DESC

Round_Bsp2

Round()
Markiert in:     

Schreibe einen Kommentar