Código SQL:
Ver originalCREATE TABLE #temp(
numero INT
)
INSERT INTO #temp VALUES (4)
INSERT INTO #temp VALUES (1)
INSERT INTO #temp VALUES (2)
INSERT INTO #temp VALUES (0)
INSERT INTO #temp VALUES (0)
INSERT INTO #temp VALUES (6)
SELECT CAST((SUM(total)/SUM(cuantos)) AS DECIMAL(10,2))
FROM(
SELECT CASE WHEN numero>0 THEN 1 ELSE 0 END cuantos,
CASE WHEN numero>0 THEN numero ELSE 0 END total
FROM #temp) t1