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: SQL to retrieve min value of the combination

Re: SQL to retrieve min value of the combination

From: Mark C. Stock <mcstockX_at_Xenquery>
Date: Wed, 7 Jan 2004 14:42:34 -0500
Message-ID: <C9ednQGywrmx_GGiRVn-tA@comcast.com>

"Turkbear" <john.g_at_dot.spamfree.com> wrote in message news:v5kovv4ifip3c7v8teaojjv2fooe3si28l_at_4ax.com...
| harve_projects_at_yahoo.com (HRR) wrote:
|
| >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 ?
| Column names would have helped..assume a, b and c
|
| Select a,min(b),min(c) from sometable
| group by a;
|
|

not exactly -- your query returns

1001 2 3
1002 5 2

either there's a typo by the OP, or, if OP really wants the row with the minimum value of 'c', you need to do a pairwise compare with a subquery (see my reply to the same OP in comp.databases.oracle)

Received on Wed Jan 07 2004 - 13:42:34 CST

Original text of this message

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