Ver Mensaje Individual
  #2 (permalink)  
Antiguo 18/04/2012, 08:28
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: Sentencia update con if

Puedes hacerlo algo asi:

Código SQL:
Ver original
  1. UPDATE TABLE
  2. SET TABLE.VALUE=t1.VALUE
  3. FROM
  4. (
  5. SELECT CASE WHEN operador=1 THEN fecha1 ELSE fecha2 AS fecha, datos FROM
  6. IRINFO DF
  7. INNER JOIN DRF
  8. ON DF.Telefono = DRF.Telefono
  9. INNER JOIN OPERADOR O
  10. ON DRF.Operador = O.CMT
  11. WHERE DF.Telefono = DRF.Telefono
  12. ) AS t1

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