I am trying to cast to Decimal in MySQL like this:
CAST((COUNT(*) * 1.5) AS DECIMAL(2))
I\'m trying to convert the number of rows in a tabl
From MySQL docs: Fixed-Point Types (Exact Value) - DECIMAL, NUMERIC:
In standard SQL, the syntax DECIMAL(M) is equivalent to DECIMAL(M,0)
DECIMAL(M)
DECIMAL(M,0)
So, you are converting to a number with 2 integer digits and 0 decimal digits. Try this instead:
CAST((COUNT(*) * 1.5) AS DECIMAL(12,2))