Cita:
Select * from cliente c inner join albaran a on
c.codigo_cliente = a.codigo_cliente and c.tienda = a.tienda
where not exists (Select * from albaran a2 inner join lineaAlbaran l on a2.tienda = l.tienda where a2.tienda = a.tienda and (year(a2.data) >= 2006 and year(a2.data) <= 2009) and l.tipoproducto <> 2)
and year a.data between 2005 and 2009
c.codigo_cliente = a.codigo_cliente and c.tienda = a.tienda
where not exists (Select * from albaran a2 inner join lineaAlbaran l on a2.tienda = l.tienda where a2.tienda = a.tienda and (year(a2.data) >= 2006 and year(a2.data) <= 2009) and l.tipoproducto <> 2)
and year a.data between 2005 and 2009
La sql me funciona pero el not exists no , si lo comento me devuelve los mismos resultados.
gracias radge