Ver Mensaje Individual
  #6 (permalink)  
Antiguo 09/02/2015, 12:34
Avatar de Libras
Libras
Colaborador
 
Fecha de Ingreso: agosto-2006
Ubicación: En la hermosa perla de occidente
Mensajes: 7.412
Antigüedad: 17 años, 8 meses
Puntos: 774
Respuesta: crear procedimiento de almacenado

se me fue un parentesis:

Código SQL:
Ver original
  1. SELECT * FROM (
  2. SELECT MOTIVO, ROW_NUMBER() OVER(partition motivo ORDER BY mes) AS rn FROM S_01_OM01_SEG_VTA_APEX_ACUM WHERE ANNO='2015' AND MICOD IN (SELECT micod FROM #temp)
  3. ORDER BY CONVERT(FLOAT,MES) DESC, CONVERT(FLOAT,DIA) DESC
  4. ) AS t1 WHERE rn<=4

saludos!
__________________
What does an execution plan say to t-sql query? Go f**k yourself, if you are not happy with me