# Thread: Sum of first five maxmum values month wise

1. Registered User
Join Date
Oct 2011
Posts
13

## Unanswered: Sum of first five maxmum values month wise

Pls tell me how to get 5 maximum values month wise

Node time Maximum
A 1/12/2012 30
B 2/12/2012 40
C 3/12/2012 67
D 4/12/2012 87
E 5/12/2012 89
G 6/12/2012 92
F 7/12/2012 12
H 8/12/2012 345
I 9/12/2012 876
J 10/12/2012 589
K 11/12/2012 123
L 12/12/2012 456
M 13/12/2012 989
N 14/12/2012 75
O 15-12-2012 69
P 16-12-2012 86
Q 17-12-2012 47
R 18-12-2012 100
S 19-12-2012 101
T 20-12-2012 149
U 21-12-2012 777
V 22-12-2012 989
W 23-12-2012 340
X 24-12-2012 345
Y 25-12-2012 2323
Z 26-12-2012 340
A 1/12/2013 334
B 2/12/2013 400
C 3/12/2013 671
D 4/12/2013 123
E 5/12/2013 2323
G 6/12/2013 334
F 7/12/2013 3434
H 8/12/2013 99
I 9/12/2013 989
J 10/12/2013 8987
K 11/12/2013 87
L 12/12/2013 87
M 13/12/2013 8987
N 14/12/2013 465
O 15-12-2013 786
P 16-12-2013 345
Q 17-12-2013 123
R 18-12-2013 100
S 19-12-2013 101
T 20-12-2013 98
U 21-12-2013 999
V 22-12-2013 1000
W 23-12-2013 10000
X 24-12-2013 37
Y 25-12-2013 34
Z 26-12-2013 78
A 1/1/2012 34
B 2/1/2012 56
C 3/1/2012 78
D 4/1/2012 98
E 5/1/2012 876
G 6/1/2012 156
F 7/1/2012 78
H 8/1/2012 99
I 9/1/2012 99
J 10/1/2012 100
K 11/1/2012 12
L 12/1/2012 34
M 13/1/2012 45
N 14/1/2012 32
A 1/2/2012 10
B 2/2/2012 90
C 3/2/2012 78
D 4/2/2012 96
E 5/2/2012 57
F 6/2/2012 84
G 7/2/2012 34
H 8/2/2012 87
I 9/2/2012 108
J 10/2/2012 129
K 11/2/2012 987
L 12/2/2012 14
A 1/3/2012 18
B 2/3/2012 100
C 3/3/2012 987
D 4/3/2012 122
E 5/3/2012 234
F 6/3/2012 343
G 7/3/2012 45
H 8/3/2012 21
I 9/3/2012 1245
J 10/3/2012 33
K 11/3/2012 55
L 12/3/2012 79

2. Registered User
Join Date
Aug 2003
Location
Where the Surf Meets the Turf @Del Mar, CA
Posts
7,776
since we don't have your table or data, we can't write your SQL.

provide CREATE TABLE & INSERT statements

3. Registered User
Join Date
Mar 2007
Posts
628
Originally Posted by amurark
Pls tell me how to get 5 maximum values month wise
I do not know who is PLS, but I will try to describe how I understand your requirement.

Firstly, divide data based on their month (or year and month; not clear from your post). Then, for each group, sort rows by "maximum values". Pick the five maximum values from the top (not sure how many rows shall be taken when some "maximum values" are the same).

I will let on you to applicate this method on data you posted to get the result.

4. Registered User
Join Date
Oct 2011
Posts
13

## My query

DATA is below
DSI_KEY_ID_ TA_PERIOD TOTMEMORYUTIL

2.00 1/5/2013 12:00:00 AM 23.36
2.00 1/5/2013 1:00:00 AM 22.24
2.00 1/5/2013 2:00:00 AM 21.14
2.00 1/5/2013 3:00:00 AM 18.85
2.00 1/5/2013 4:00:00 AM 18.34
2.00 1/5/2013 5:00:00 AM 18.31
2.00 1/5/2013 6:00:00 AM 18.86
2.00 1/5/2013 7:00:00 AM 18.87
2.00 1/5/2013 8:00:00 AM 18.20
2.00 1/5/2013 9:00:00 AM 18.28
2.00 1/5/2013 10:00:00 AM 18.40
2.00 1/5/2013 11:00:00 AM 18.51
2.00 1/5/2013 12:00:00 PM 18.60
2.00 1/5/2013 1:00:00 PM 18.65
2.00 1/5/2013 2:00:00 PM 18.78
2.00 1/5/2013 3:00:00 PM 18.81
2.00 1/5/2013 4:00:00 PM 18.86
2.00 1/5/2013 5:00:00 PM 18.93
2.00 1/5/2013 6:00:00 PM 18.97
2.00 1/5/2013 7:00:00 PM 18.49
2.00 1/5/2013 8:00:00 PM 18.53
2.00 1/5/2013 9:00:00 PM 18.55
2.00 1/5/2013 10:00:00 PM 18.27
2.00 1/5/2013 11:00:00 PM 18.30

########################
Output shuld be

DSI_KEY_ID_ TA_PERIOD TOTMEMORYUTIL MAXIMUM 5 values

2.00 1/5/2013 12:00:00 AM 23.36 23.36
2.00 1/5/2013 1:00:00 AM 22.24 22.24
2.00 1/5/2013 2:00:00 AM 21.14 21.14
2.00 1/5/2013 6:00:00 PM 18.97 18.97
2.00 1/5/2013 5:00:00 PM 18.93 18.93
2.00 1/5/2013 7:00:00 AM 18.87
2.00 1/5/2013 6:00:00 AM 18.86
2.00 1/5/2013 4:00:00 PM 18.86
2.00 1/5/2013 3:00:00 AM 18.85
2.00 1/5/2013 3:00:00 PM 18.81
2.00 1/5/2013 2:00:00 PM 18.78
2.00 1/5/2013 1:00:00 PM 18.65
2.00 1/5/2013 12:00:00 PM 18.60
2.00 1/5/2013 9:00:00 PM 18.55
2.00 1/5/2013 8:00:00 PM 18.53
2.00 1/5/2013 11:00:00 AM 18.51
2.00 1/5/2013 7:00:00 PM 18.49
2.00 1/5/2013 10:00:00 AM 18.40
2.00 1/5/2013 4:00:00 AM 18.34
2.00 1/5/2013 5:00:00 AM 18.31
2.00 1/5/2013 11:00:00 PM 18.30
2.00 1/5/2013 9:00:00 AM 18.28
2.00 1/5/2013 10:00:00 PM 18.27
2.00 1/5/2013 8:00:00 AM 18.20

5. Lost Boy
Join Date
Jan 2004
Location
Croatia, Europe
Posts
4,113