Ver Mensaje Individual
  #1 (permalink)  
Antiguo 11/11/2004, 07:31
carlostapia
 
Fecha de Ingreso: septiembre-2004
Mensajes: 141
Antigüedad: 20 años, 6 meses
Puntos: 0
No Me Resulta El Porcentaje Porque???

HOLAS TENGO EL SIGUIENTE PROBLEMA QUIERO HACER ESTE PROCENTAJE PERO NO ME ESTA RESULTANDO


declare @Total1 int
declare @Cien float
select @Total1 = sum(TOTAL), @Cien=100.0 from ##r1

--select @total1 from ##r1

select tipo_email ,total, @total1 AS TOTAL2,
(@TOTAL1/total) AS DIVIDE,
(TOTAL/@TOTAL1) AS DIVIDE2
---(( convert (float, count(*) ) / @Total1 )*100.0 ) as totalP
--convert(float,(@totalX) as Porcentaje
from ##r1
group by tipo_email,total
--( convert (decimal(8,2), count(*))/' + convert(varchar,@Total) + ')*100) as Porcentaje %
order by tipo_email

Y ME DA

tipo_email total TOTAL2 DIVIDE DIVIDE2
-------------------------------------------------- ----------- ----------- ----------- -----------
1 4 11 2 0
2 3 11 3 0
3 1 11 11 0
4 3 11 3 0

(4 row(s) affected)