Ver Mensaje Individual
  #4 (permalink)  
Antiguo 18/10/2011, 10:08
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: Max de fechas con 2 columnas

Código SQL:
Ver original
  1. CREATE TABLE #temp
  2. (
  3. id INT,
  4. año INT,
  5. mes INT
  6. )
  7. DELETE FROM #temp
  8. INSERT INTO #temp VALUES (1,2011,10)
  9. INSERT INTO #temp VALUES (2,2011,9)
  10.  
  11. SELECT * FROM #temp WHERE año=datepart(yy,getdate()) AND mes=datepart(mm,getdate())

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