sábado, 1 de marzo de 2008

Obtener las ciudades donde hay proyectos que usan todas las partes vendidas en exclusiva por el proveedor “S1”

Siempre Trabajando sobre esta Base de Datos:
S(S#, Snombre, Situación, Ciudad)
P(P#, Pnombre, Color, Peso, Ciudad)
J(J#, Jnombre, ciudad)
SPJ(S#,P#,J#, Cantidad)


Select distinct Ciudad
From J
Where not exists (select P#
From SPJ A
Where not exixts (select *
From SPJ
Where P# = A.P#
And S#<>”S1”)
And not exists (select *
From SPJ
Where P# = A.P#
And J# = J.J#));

No hay comentarios: