Ver Mensaje Individual
  #2 (permalink)  
Antiguo 24/07/2008, 09:22
Avatar de flaviovich
flaviovich
 
Fecha de Ingreso: agosto-2005
Ubicación: Lima, Peru
Mensajes: 2.951
Antigüedad: 19 años, 6 meses
Puntos: 39
Respuesta: Obtener los que faltan

Una solución podría ser:
Código:
declare @min int, @max int
select @min=min(corr_entrega), @max=max(corr_entrega) from entrega
select @min [corr] into tmp_corr
while @min < @max
begin
    set @min = @min + 1
    insert into tmp_corr select @min
end
select corr from tmp_corr t 
left join entrega e on t.corr=e.corr_entrega
where e.corr_entrega is null
Suerte!
__________________
No repitamos temas, usemos el Motor de busquedas
Plantea bien tu problema: Ayúdanos a ayudarte.