Ok I have 3 tables
1) S...and it has
sno*, sname, status, city
2) P.......and it has
pno*, pname, color, weight, city
3) SP.....and it has
sno*, pno*, qty
THis is actually for a class at school but I tried for 3 hours on this problem and can't get it to work.
My problem is this:
-----------------------------------------------------------
Get the names of the suppliers located in London or Paris, and who have shipped at least one green part and at least one red part. The supplier names must be listed in lexicographical order, and each supplier name must appear at most once.
-------------------------------------------------------
The problem before it was exacly the same exept it was with at least one red part OR at least one green part.
I got that to work with this statment.
select distinct s.sname
from s,p, sp where (s.city = 'Paris' or s.city = 'London'
and (p.color = 'red' or p.color = 'green') and sp.qty > 1 and sp.sno = s.sno and sp.pno = p.pno
order by s.sname asc
Any help is appriciated as I dont know what to do.
1) S...and it has
sno*, sname, status, city
2) P.......and it has
pno*, pname, color, weight, city
3) SP.....and it has
sno*, pno*, qty
THis is actually for a class at school but I tried for 3 hours on this problem and can't get it to work.
My problem is this:
-----------------------------------------------------------
Get the names of the suppliers located in London or Paris, and who have shipped at least one green part and at least one red part. The supplier names must be listed in lexicographical order, and each supplier name must appear at most once.
-------------------------------------------------------
The problem before it was exacly the same exept it was with at least one red part OR at least one green part.
I got that to work with this statment.
select distinct s.sname
from s,p, sp where (s.city = 'Paris' or s.city = 'London'
and (p.color = 'red' or p.color = 'green') and sp.qty > 1 and sp.sno = s.sno and sp.pno = p.pno
order by s.sname asc
Any help is appriciated as I dont know what to do.