query($sql);
echo "Unterscheidung:
";
while($dsatz = $res->fetch_assoc())
echo $dsatz["hersteller"] . "
";
$res->close();
echo "
";
$sql = "SELECT"
. " COUNT(artnummer) AS artikel,"
. " COUNT(DISTINCT hersteller) AS hersteller,"
. " MAX(preis) AS maximum,"
. " MIN(preis) AS minimum,"
. " SUM(preis) AS summe,"
. " AVG(preis) AS mittelwert"
. " FROM fp";
$res = $con->query($sql);
$dsatz = $res->fetch_assoc();
echo "Aggregatfunktionen:
";
echo "Anzahl Artikel: " . $dsatz["artikel"] . "
";
echo "Anzahl Hersteller: " . $dsatz["hersteller"] . "
";
echo "Höchster Preis: " . $dsatz["maximum"] . " €
";
echo "Niedrigster Preis: " . $dsatz["minimum"] . " €
";
echo "Summe der Preise: " . $dsatz["summe"] . " €
";
echo "Mittlerer Preis: "
. number_format($dsatz["mittelwert"], 2) . " €
";
$res->close();
$con->close();
?>