I have the following table
userid--state-----fraction
589-----wrong---0,0
589-----wright---1,0
589-----wright---1,0
589-----wrong---0,0
589-----wrong---0,0
589-----wrong---0,0
589-----wrong---0,0
589-----wrong---0,0
589-----wrong---0,0
589-----gaveup--NULL
When trying to bring the average using the query below the line where the state
value is gaveup
is not considered, by fraction
has value NULL
:
How can I assign value 0,0
to fraction
if the value state
is gaveup
to get the mean correctly?
SELECT avg(fraction) FROM table