Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
AskSQLTeam
Ask SQLTeam Question
0 Posts |
Posted - 2004-11-17 : 07:10:02
|
ng writes "Table Suppliers SNo SNAME STATUS CITY S1 Smith 20 London S2 Jones 10 Paris S3 Blake 30 Paris S4 Clark 20 London S5 Adams 30 Athens Table PartsPNo PNAME COLOR WEIGHT CITYP1 Nut Red 12 LondonP2 Bolt Green 17 ParisP3 Screw Blue 17 RomeP4 Screw Red 14 LondonP5 Cam Blue 12 ParisP6 Cog Red 19 LondonTable ProjectsJNo JNAME CITYJ1 Sorter ParisJ2 Puncher RomeJ3 Reader AthensJ4 Console AthensJ5 Collator LondonJ6 Terminal OsloJ7 Tape LondonTable ShipmentsSNo PNo JNo QTYS1 P1 J1 200S1 P1 J4 700S2 P3 J1 400S2 P3 J2 200S2 P3 J3 200S2 P3 J4 500S2 P3 J5 600S2 P3 J6 400S2 P3 J7 800S2 P5 J2 200S3 P3 J1 200S3 P4 J2 500S4 P6 J3 300S4 P6 J7 300S5 P2 J2 200S5 P2 J4 100S5 P5 J5 500S5 P5 J7 100S5 P6 J2 200S5 P1 J4 100S5 P3 J4 200S5 P4 J4 800S5 P5 J4 400S5 P6 J4 500The names and identifiers of the suppliers who supply at least all theparts that are supplied by supplier S2.Please help me............................ " |
|
|
X002548
Not Just a Number
15586 Posts |
Posted - 2004-11-17 : 09:27:04
|
| What course is this for?Brett8-) |
 |
|
|
jen
Master Smack Fu Yak Hacker
4110 Posts |
Posted - 2004-11-17 : 21:47:38
|
quote: Originally posted by X002548 What course is this for?Brett8-)
ha ha ha, and not even a starting query to work with.--------------------keeping it simple... |
 |
|
|
shreyas
Starting Member
2 Posts |
Posted - 2004-12-14 : 07:13:07
|
You can run the query given below to get the output.select b.sno from (select pno from shipments where sno ='s2' group by sno, pno ) ainner join (select sno, pno from shipments where sno <>'s2' group by sno, pno) b on a.pno = b.pno group by b.sno having count(*) = (select count(distinct(pno)) from shipments where sno ='s2' )Vishal Malhotraquote: Originally posted by AskSQLTeam ng writes "Table Suppliers SNo SNAME STATUS CITY S1 Smith 20 London S2 Jones 10 Paris S3 Blake 30 Paris S4 Clark 20 London S5 Adams 30 Athens Table PartsPNo PNAME COLOR WEIGHT CITYP1 Nut Red 12 LondonP2 Bolt Green 17 ParisP3 Screw Blue 17 RomeP4 Screw Red 14 LondonP5 Cam Blue 12 ParisP6 Cog Red 19 LondonTable ProjectsJNo JNAME CITYJ1 Sorter ParisJ2 Puncher RomeJ3 Reader AthensJ4 Console AthensJ5 Collator LondonJ6 Terminal OsloJ7 Tape LondonTable ShipmentsSNo PNo JNo QTYS1 P1 J1 200S1 P1 J4 700S2 P3 J1 400S2 P3 J2 200S2 P3 J3 200S2 P3 J4 500S2 P3 J5 600S2 P3 J6 400S2 P3 J7 800S2 P5 J2 200S3 P3 J1 200S3 P4 J2 500S4 P6 J3 300S4 P6 J7 300S5 P2 J2 200S5 P2 J4 100S5 P5 J5 500S5 P5 J7 100S5 P6 J2 200S5 P1 J4 100S5 P3 J4 200S5 P4 J4 800S5 P5 J4 400S5 P6 J4 500The names and identifiers of the suppliers who supply at least all theparts that are supplied by supplier S2.Please help me............................ "
VM |
 |
|
|
|
|
|