0

Hi,

I am very new to SQL and I am working on a query. I am to use a flat select statement

I am to :
Print all S#s such that the indicated supplier supplies a
London project and also supplies a Paris project

There are 3 tables, one with supplier information (S), one with jobs (J), one with parts (P) and one with shipments (SPJ).

This is what I have but it doesn't work

SELECT S.s#
FROM S, SPJ, J WHERE
J.city = 'London' or J.city = 'Paris'
and J.j# = SPJ.j#
and SPJ.s# = S.s#

This is returning all the suppliers that ship to either Paris or London but not both.

Please help. Thx

2
Contributors
1
Reply
2
Views
9 Years
Discussion Span
Last Post by dickersonka
0

use a select with a subselect

don't know your columns but you basically need to just issue your query twice and use something like

select * from s, spj, j where s.id in 
(select s.id from s, spj, j where j.city='london') and j.location = 'paris'

i didn't put your joins in there, cause i don't know what j# or s# is, but this is how to do it

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.