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: Thomas Kyte <tkyte_at_us.oracle.com>
Date: Mon, 26 Apr 1999 16:24:18 GMT
Message-ID: <373092a2.19919072@192.86.155.100>


A copy of this was sent to jpetts_at_celltech.co.uk (James Petts) (if that email address didn't require changing) On Mon, 26 Apr 1999 15:21:16 GMT, you wrote:

>Hi
>
>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...

just divide.

>Can anybody suggest an easy way to do this in SQL or do I need to
>resort to PL/SQL?
>
>James Petts
 

Thomas Kyte
tkyte_at_us.oracle.com
Oracle Service Industries
Reston, VA USA

--
http://govt.us.oracle.com/ -- downloadable utilities  



Opinions are mine and do not necessarily reflect those of Oracle Corporation Received on Mon Apr 26 1999 - 11:24:18 CDT

Original text of this message

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