I have what seems like a simple problem, but I can't seem to figure it out.
As an example, I have the following db2 table:
Table = TESTB
MO NUM
1 8
2 40
3 16
4 25
5 36
6 2
I need to find the following values in a single query:
min(num) = 2
max(num) = 40
sum(num) = 127
mo of the min(num) = 6
mo of the max(num) 2
This gets all but the last two:
select min(num),
max(num)
sum(num)
from testb
How do I get the mo related to the min(num) as well as the mo related to the max(num) incorporated into the same statement?
As an example, I have the following db2 table:
Table = TESTB
MO NUM
1 8
2 40
3 16
4 25
5 36
6 2
I need to find the following values in a single query:
min(num) = 2
max(num) = 40
sum(num) = 127
mo of the min(num) = 6
mo of the max(num) 2
This gets all but the last two:
select min(num),
max(num)
sum(num)
from testb
How do I get the mo related to the min(num) as well as the mo related to the max(num) incorporated into the same statement?