Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.misc -> Re: SQL query problem
On Thu, 26 Feb 1998 22:01:17 GMT, bobmc_at_cyberramp.net (Bob McConnell) wrote: Hi,
try
SELECT
t1.field1, t1.field2, t3.field2 t3.field3 FROM table1 t1, table2 t2, table3 t3 WHERE t1.field1=t2.field1 AND t1.field2=t3.field1 ORDER BY t2.field2, t3.field2
>I am trying to resolve the following query problem:
>
>table 1 contains 2 fields containing product discriptions such as:
> field 1 field 2
> apples oranges
> apples apples
> oranges bananas
> pears apples
>etc.
> the fields may or maynot contain the same description.
>
>table 2
> field1 field2
> apples 10
> pears 20
> bananas 30
> oranges 50
>
>The problem is to select field 1 and 2 from table 1 and order the
>results by values found in table 2
>
>I would like to do some sort of join where my select of all records
>from table 1 would return something liker:
> apples oranges 10 50
> apples apples 10 10
> oranges bananas 50 30
> pears apples 20 10
>allowing me to order the final results to be
> apples apples
> pears apples
> apples oranges
> oranges bananas
>
>Can someone point me in the right direction?
>
>Thank,
>Bob
>
-- Regards Matthias Gresz :-) GreMa_at_T-online.deReceived on Fri Feb 27 1998 - 00:00:00 CST
![]() |
![]() |