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

Home -> Community -> Usenet -> comp.databases.oracle -> Re: SQL to retrieve min value of the combination

Re: SQL to retrieve min value of the combination

From: Julia Sats <julia.sats_at_sympatico.ca>
Date: Thu, 8 Jan 2004 20:44:08 -0500
Message-ID: <iKnLb.79822$BA6.1688941@news20.bellglobal.com>

Use this one , the same but easier
 select *
 from (

     select col1, min(col3)
     from   x
     group by col1
     )

"Mark C. Stock" <mcstockX_at_Xenquery .com> wrote in message news:D_6dneS_LcPC0WGiRVn-jg_at_comcast.com...
> question's a little vague, but assuming you are trying to get records for
> the minimum values of the first and third column, for all rows in a table,
> you could try a subquery like
>
> select *
> from x
> where (col1, col3) in (
> select col1, min(col3)
> from x
> group by col1
> )
>
> but don't try this until you understand why it works ;-)
>
> -- mcs
>
>
> "Ravindra Harve" <rharve_at_hotmail.com> wrote in message
> news:835dd0ad.0401070930.575a25ba_at_posting.google.com...
> | Hi,
> |
> | I have the following table
> |
> | 1001 2 3
> | 1001 3 5
> | 1001 5 7
> | 1002 5 4
> | 1002 6 2
> |
> | I need to get a result
> |
> | 1001 2 3
> | 1002 6 2
> |
> | How is it possible ?
>
>
Received on Thu Jan 08 2004 - 19:44:08 CST

Original text of this message

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