Skip to content
Advertisement

how to show decimals in sql instead of 0

I am trying to get the percent and it just shows up as zero. I want to show two decimal places such as 0.65 Here is a piece of the query I am selecting:

if I use this it shows up as 0 and gets rid of the rest

Advertisement

Answer

Meanwhile, I question whether COUNT(numbers) is what you want. That counts how many rows have a non-NULL value in the column numbers.

Also, fraction is usually more like x / (x+y) — meaning the fraction of the total (x+y) that is x.

A “percentage” needs 100* somewhere. 13/20 is the fraction 0.65 or the percentage 65.00 .

User contributions licensed under: CC BY-SA
10 People found this is helpful
Advertisement