Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Data Bases > Pgsql Sql > Re: columns for...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 3 of 4 Topic 3447 of 3797
Post > Topic >>

Re: columns for count histograms of values

by chestercyoung@[EMAIL PROTECTED] (chester c young) Apr 30, 2008 at 04:12 PM

--- Alexy Khrabrov <deliverable@[EMAIL PROTECTED]
> wrote:

> Greetings -- I have a table of the kind
> 
> Ratings:
> id integer
> rating smallint
> 
> -- where value can take any value in the range 1 to 5.  Now I want to
>  
> have a statistical table Stats of the form
> 
> id integer
> min smallint
> max smallint
> avg real
> r1 integer
> r2 integer
> r3 integer
> r4 integer
> r5 integer
> 
> -- how can I create it in one pass over Ratings? 

select id, min(rating), max(rating), avg(rating),
  sum( case rating = 1 then 1 else 0 end ),
  ...



     
____________________________________________________________________________________
Be a better friend, newshound, and 
know-it-all with Yahoo! Mobile.  Try it now. 
http://mobile.yahoo.com/;_ylt=Ahu06i62sR8HDtDypao8Wcj9tAcJ

-- 
Sent via pgsql-sql mailing list (pgsql-sql@[EMAIL PROTECTED]
)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-sql
 




 4 Posts in Topic:
columns for count histograms of values
deliverable@[EMAIL PROTEC  2008-04-30 14:01:13 
Re: columns for count histograms of values
magawake@[EMAIL PROTECTED  2008-04-30 21:32:51 
Re: columns for count histograms of values
chestercyoung@[EMAIL PROT  2008-04-30 16:12:12 
Re: columns for count histograms of values
deliverable@[EMAIL PROTEC  2008-05-01 01:35:46 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Mon Dec 1 9:42:01 CST 2008.