Ver Mensaje Individual
  #2 (permalink)  
Antiguo 27/05/2014, 06:50
GeriReshef
 
Fecha de Ingreso: julio-2012
Ubicación: Israel
Mensajes: 360
Antigüedad: 11 años, 9 meses
Puntos: 40
Respuesta: Sentencia para borrar filas

Intentaria asi:
Código SQL:
Ver original
  1. WITH T AS
  2. (SELECT *,
  3.     COUNT(CASE WHEN Producto IN ('A','B') THEN 1 END) OVER(Partition BY Cliente) N
  4. FROM    MiTabla)
  5. DELETE
  6. FROM    T
  7. WHERE   N=2
  8.     AND Producto='B';
__________________
El Castellano no es mi lengua materna: discúlpenme por los errores gramaticales.
Mi blog