Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.misc -> Re: Urgent help on SQL

Re: Urgent help on SQL

From: William Hill <cnsltwlh_at_GeeTeeEee.net>
Date: 1997/07/23
Message-ID: <5r5ust$64a$2@gte1.gte.net>#1/1

select available, capacity from table_a a where route = 11 and
available = (select min(b.available) from table_a b

             where route = 11);

In article <869684186.30768_at_dejanews.com>, sgulukot_at_bbnplanet.com says...
>
>Try this query
>
>Select available, capacity
>from table_a
>where available = (select min(available)
> from table_a);
>
>This query will return all the rows that have minimum available. Where
>clause on route depends on whether you want it.
>
>On 23 Jul 1997 06:00:29 GMT, brianbom_at_mail.pacifier.com (HornDog) wrote:
>
>>Given the following table
>>
>>table_a
>>
>>route available capacity
>>
>>11 1200 3000
>>11 1400 2000
>>11 900 5000
>>
>>I need a query that will return a single row that has the minimum
>>"available"
>>value of the three rows and the corresponding "capacity".
>>
>>I wrote the following query that returns '900', but how can I get the
>>'5000'
>>that goes along with it?
>>
>
>select * from table_a
>where ( route, available ) = (
>>SELECT route, MIN(available)
>>FROM table_a
>>WHERE route=11
>>GROUP BY route
>);
>
>-------------------==== Posted via Deja News ====-----------------------
> http://www.dejanews.com/ Search, Read, Post to Usenet
Received on Wed Jul 23 1997 - 00:00:00 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US