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

Home -> Community -> Usenet -> c.d.o.server -> Re: query with Min function

Re: query with Min function

From: ben brugman <ben_at_niethier.nl>
Date: Fri, 11 Jul 2003 15:11:12 +0200
Message-ID: <3f0eb770$0$13796$4d4ebb8e@read.news.nl.uu.net>


Do not use the group by clause and you get only the min(a.datainserimento).

Using the group by clause makes that you get one row for each group, because you use the PK as groups you get all the rows.

I do not understand "with the date nearest at other one taken as input"
This condition would probably end up in the WHERE clause

ben brugman

"MARCOF" <wwwmarco_at_yahoo.it> wrote in message news:84c9a426.0307110501.7d9fbb11_at_posting.google.com...
> I HAve a table (datitemppirisposta) (ORACLE)
> it has 3 colums
> DataInserimento, codicecontrollo, temporisposta
>
> The first 2 colims are primary key.
>
> I have to select "tempodirisposta" with the date nearest at other one
> taken as input
>
> Es.
> select
> min(a.datainserimento), a.temporisposta
> from
> datitempirisposta where
> a.codicecontrollo = 'C0005098' and
> a.datainserimento > to_Date('01/06/2003','dd/mm/yyyy')
> group by a.datainserimento, a.temporisposta
> order by a.datainserimento
>
> In this way i have got many rows instead i need only one row .
Received on Fri Jul 11 2003 - 08:11:12 CDT

Original text of this message

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