Search Postgresql Archives

query on query

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

I have a table like this –

postgres=# \d m

       Table "public.m"

Column |  Type   | Modifiers

--------+---------+-----------

id     | integer |

marks  | integer |

 

postgres=# select * from m;

id | marks

----+-------

  1 |    27

  2 |    37

  3 |    17

  4 |    27

  5 |    18

(5 rows)

 

I wanted to get cumulative counts of students in different ranges – >90, > 80  , > 70  etc.

>10  5

>20  3

>30  1

>40 0

> 50 0

 

So each student may get counted many times, someone with 99 will be counted 10 times. Possible to do this with a fat query? The table will have many thousands of records.

 

 

Regards,

Jayadevan

 



DISCLAIMER: "The information in this e-mail and any attachment is intended only for the person to whom it is addressed and may contain confidential and/or privileged material. If you have received this e-mail in error, kindly contact the sender and destroy all copies of the original communication. IBS makes no warranty, express or implied, nor guarantees the accuracy, adequacy or completeness of the information contained in this email or any attachment and is not liable for any errors, defects, omissions, viruses or for resultant loss or damage, if any, direct or indirect."

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux