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: Frank <Oaplont_at_work.no>
Date: Fri, 01 May 1998 06:05:45 GMT
Message-ID: <6ibonj$ui4$1@hdxf08.telecom.ptt.nl>


Hi,

Why don't you first try your query before posting ?? I think you'll find that ng-readers are less likely to take you seriously if you post non-working solutions !

(rownum does _not_ work in combination with order by: Oracle _first_ analyzes the where-clause, returning 20 rows, more or less randomly selected; then they get ordered.)

brendan_o'brien_at_wrightexpress.com wrote:

>Two problems:

>1) When you say 'files', I'm presuming you mean records. May sound petty (I
>understand that you're a novice), but I think you'll find that newsgroup/forum
>users are less likely to respond to you if you don't have basic terminology
>straight.

>2) When you say 'biggest', to what are you referring? For the sake of
>argument I'm going to presume that what you mean is the length (number of
>characters) in a given column. I will further presume that the column you
>mean is 'name'. If so:

>SELECT * FROM tablename
>WHERE rownum <=20
>ORDER BY length(name) DESC

>You should get values from all (both?) columns for the 20 records in your
>table returned in highest to lowest order based on number of characters in the
>'name' column.

>- Eliminating the WHERE clause will return all rows.

>- Removing the keyword DESC will return the rows in lowest-to-highest order.

>- Replacing the * with specific column names delimited by commas will return
>only those columns you care to see instead of all columns.

>- Adding the calculated column "length(name)" to your list of columns in the
>SELECT clause will return not only the desired columns but an additional
>column displaying the number of characters in the 'name' column (the same
>value used in the ORDER clause for sorting your results).

>Good luck.
>-Brendan

>In article <6ia1g1$20v$2_at_antwerpen.planetinternet.be>,
> "Elvis" <p2760_at_hotmail.com> wrote:
>>
>> hi,
>>
>> student needs help
>>
>> how can i select the 20 biggest files from my table????????
>>
>> table files
>> -------------
>> naam varchar2(50)
>> size integer
>>
>> thanks
>>
>> bart
>>
>>

>-----== Posted via Deja News, The Leader in Internet Discussion ==-----
>http://www.dejanews.com/ Now offering spam-free web-based newsreading
Received on Fri May 01 1998 - 01:05:45 CDT

Original text of this message

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