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: Binning data

Re: Binning data

From: James Petts <jpetts_at_celltech.co.uk>
Date: Wed, 28 Apr 1999 08:12:29 GMT
Message-ID: <3726c2a6.171058348@right.celltech>


On Mon, 26 Apr 1999 16:24:18 GMT, tkyte_at_us.oracle.com (Thomas Kyte) wrote:

>>I have a series of real numbers, and I want to bin the data by ranges,
>>and get a count of the number of values in each bin. The values range
>>from 75.1 to 1200.4, and I want to bin them in steps of fifty. Thus, I
>>want to count all values between 50.0001 and 100.0000, between
>>100.0001 and 150.0000, etc., all the way up to the range from
>>1200.0001 to 1250.0000.
>>
>
>select trunc( column/50 ), count(*) from T group by trunc(column/50)
>/
>
>so, 0 .. upto but not including 50 -> 0
> 50 .. upto but not including 100 -> 1
> and so on...
>

Thanks very much Tom. Does just what I need. Thanks also to Mauro Papandrea who suggested using floor instead of trunc.

James Petts Received on Wed Apr 28 1999 - 03:12:29 CDT

Original text of this message

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