CAST to DECIMAL in MySQL

Ich versuche in MySQL auf Dezimal umzustellen:

CAST((COUNT(*) * 1.5) AS DECIMAL(2))

Ich versuche, die Anzahl der Zeilen in einer Tabelle (mal 1,5) in eine Gleitkommazahl mit zwei Ziffern nach dem Punkt umzuwandeln.

SQL-Code:

 SELECT CONCAT(Guardian.title, ' ', 
               Guardian.forename, ' ', 
               Guardian.surname) AS 'Guardian Name', 
               COUNT(*) AS 'Number of Activities', 
               (COUNT(*) * 1.5) AS 'Cost'
 FROM Schedule
 INNER JOIN Child ON Schedule.child_id = Child.id
 INNER JOIN Guardian ON Child.guardian = Guardian.id
 GROUP BY Guardian
 ORDER BY Guardian.surname, Guardian.forename ASC

Es entsteht ein Fehler:

#1064 - You have an error in your SQL syntax; check the manual that 
corresponds to your MySQL server version for the right syntax to use 
near 'CAST((COUNT(*) * 1.5) AS DECIMAL(12,2))' at line 1.

Ein weiterer Versuch, diese Besetzung funktioniert auch nicht:

 SELECT CONCAT(Guardian.title, ' ', 
               Guardian.forename, ' ', 
               Guardian.surname) AS 'Guardian Name', 
               COUNT(*) AS 'Number of Activities', 
               CAST((COUNT(*) * 1.5) AS DECIMAL(8,2)) AS 'Cost'
 FROM Schedule
 INNER JOIN Child ON Schedule.child_id = Child.id
 INNER JOIN Guardian ON Child.guardian = Guardian.id
 GROUP BY Guardian
 ORDER BY Guardian.surname, Guardian.forename ASC

Wie verwende ich MySQL, um von Integer zu Dezimal umzuwandeln?

Antworten auf die Frage(3)

Ihre Antwort auf die Frage