MAK MAK - 3 months ago 8
SQL Question

PostgreSQL 9.3: Convert to float

I want to convert the calculated values into


My try 1:

SELECT float(SUM(Seconds))/-1323 AS Averag;

Gives me an error:

syntax error at or near "SUM"

My try 2:

SELECT to_float(SUM(Seconds))/-1323 AS Averag;

Gives me an error:

function to_float(bigint) does not exist


You need to use the cast syntax:

SELECT CAST (SUM(Seconds) AS FLOAT)/-1323 AS Averag;