Home » SQL & PL/SQL » SQL & PL/SQL » How to form this query
How to form this query [message #206130] Tue, 28 November 2006 21:50 Go to next message
vgs2005
Messages: 123
Registered: April 2005
Senior Member
Hi,

I have a table Detail which has:

Supplier   Store   Item
--------   -----   ----
Supp1      Store1  I1
Supp1      Store1  I2
Supp1      Store1  I3
Supp2      Store1  I4
Supp2      Store2  I4


And Table Partner which has distinct combinations of Supplier-Store:

ID  Supplier  Store
--  -------   -----
11  Supp1     Store1
12  Supp2     Store1 
13  Supp2     Store2 


I need to query the Item and its associated Partner ID:

Partner ID   Item
----------   -----
11           I1 
11           I2 
11           I3
12           I4
13           I4


How do I form the query?? please help.. Thanks in advance
Re: How to form this query [message #206131 is a reply to message #206130] Tue, 28 November 2006 21:58 Go to previous messageGo to next message
ruyue
Messages: 9
Registered: July 2006
Junior Member
try this:
select b.id,a.item from detail a,parter b
where a.Supplier=b.Supplier  and a.Store=b.Store; 

Re: How to form this query [message #206158 is a reply to message #206131] Wed, 29 November 2006 00:14 Go to previous message
vgs2005
Messages: 123
Registered: April 2005
Senior Member
Tsk, tsk.. Brain's been so rusty... Embarassed
Previous Topic: How the does MINUS work
Next Topic: Executing procedure
Goto Forum:
  


Current Time: Wed Dec 07 03:08:34 CST 2016

Total time taken to generate the page: 0.17888 seconds