Ver Mensaje Individual
  #6 (permalink)  
Antiguo 17/06/2013, 16:24
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: Distinct? Group by? Having? Cual!!?

no pues con razon...la funcion over() esta disponible desde sql server 2005 en adelante....

el resultado de Nullz3r0 sin over queda de la sig manera:
Código SQL:
Ver original
  1. SELECT t4.Autor, t4.Titulo, T4.Fecha FROM (
  2.  
  3. SELECT t1.Id Autor, t2.titulo, t2.Fecha,total
  4. FROM #TABLA_AUTORES t1
  5. INNER JOIN #TABLA_ARTICULOS t2 ON t1.id = t2.autor AND t2.Fecha > CONVERT(DATE,Getdate()-91)
  6. LEFT JOIN
  7. (SELECT COUNT(t1.id) total,t1.id FROM #TABLA_AUTORES t1
  8. INNER JOIN #TABLA_ARTICULOS t2 ON t1.id = t2.autor AND t2.Fecha > CONVERT(DATE,Getdate()-91)
  9. GROUP BY t2.autor,t1.id) t3 ON t1.id=t3.id
  10.  
  11.  
  12. ) T4
  13. WHERE t4.total = 1

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