Ver Mensaje Individual
  #2 (permalink)  
Antiguo 21/06/2011, 05:57
Avatar de ceSharp
ceSharp
 
Fecha de Ingreso: octubre-2008
Ubicación: Madrid
Mensajes: 495
Antigüedad: 15 años, 6 meses
Puntos: 66
Respuesta: Crear columna en consulta SQL

hola informacionsys,

la verdad está ahí afuera...

SELECT TOP 5 cod_tipo, COUNT(cantidad),rank() over(order by cantidad desc) as ranking
FROM tipos_ventas
WHERE tip_recep IN ('PS','WB','SN') AND cod_grupo = '100'
GROUP BY cod_tipo ORDER BY cantidad DESC

saludos.