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: query problem help needed

Re: query problem help needed

From: Nuno Guerreiro <nuno-v-guerreiro_at_telecom.pt>
Date: Mon, 04 May 1998 09:55:57 GMT
Message-ID: <354d8e9f.1103983594@news.telecom.pt>


On Sat, 2 May 1998 12:25:36 +0100, "Colin Sutherland" <c.sutherland_at_easynet.com> wrote:

>Hi
>
>Here another option
>
> SELECT name, max(size)
> FROM tablename
> WHERE rownum < 21
> GROUP BY name
>
>HTH
>
>Colin.

I'm afraid but I don't think this statement will retrieve the 20 biggest files on the table.

This statement will select ARBITRARY rows from the table (which may or may not belong to the 20 biggest files), form groups with rows which have the same name. Normally, the names of the files should be unique, so the MAX function will give exactly the size of the file for each group.

Even if the field "name" is not unique, the MAX function would return the maximum size of a group.

Finally, the line "WHERE rownum < 21" will simply limit the output to the 20 first rows, it will have no influence on the size of the files being retrieved.

Nuno Guerreiro Received on Mon May 04 1998 - 04:55:57 CDT

Original text of this message

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