From: | Jayadevan M <jayadevan(dot)maymala(at)ibsplc(dot)com> |
---|---|
To: | "pgsql-general(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)org> |
Subject: | query on query |
Date: | 2013-07-05 03:09:04 |
Message-ID: | 3411BBAFF5A2244FA405CC91D9473A602369B076@PBOX2.ibsplc.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
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."
From | Date | Subject | |
---|---|---|---|
Next Message | guxiaobo1982 | 2013-07-05 05:11:07 | 回复: [GENERAL] Can't create plpython language |
Previous Message | Michael Paquier | 2013-07-05 01:10:45 | Re: decrease my query duration |