View previous topic :: View next topic
|
Author |
Message |
ajeshrn
New User
Joined: 25 Mar 2009 Posts: 78 Location: India
|
|
|
|
Hi,
The requirement is like this:
We have certain Organization and Institutions,and each Organization can have more than one Institutions.
Ex:
Org Id Institution Id
1 100
1 101
1 102
1 199
2 200
2 500
2 501
2 510
2 511
2 512
The expected results should be as below:
Organization Institution Groups
1 100-102,199
2 200,500-501,510-512
Is there a way we can do this through DB2 query? |
|
Back to top |
|
|
Ketan Varhade
Active User
Joined: 29 Jun 2009 Posts: 197 Location: Mumbai
|
|
|
|
Please you could explain how exactly you want is the requirement, I am not getting in what format you the exact output. |
|
Back to top |
|
|
ajeshrn
New User
Joined: 25 Mar 2009 Posts: 78 Location: India
|
|
|
|
Hi Ketan,
The expected result is 2 coulmns from the query-Org Id and Institution Id groupings, where Org Id will contain the Organization id's and the second column will contain the Institution groups given above. |
|
Back to top |
|
|
ashimer
Active Member
Joined: 13 Feb 2004 Posts: 551 Location: Bangalore
|
|
|
|
MAx and Min value fetch - what applies here ? |
|
Back to top |
|
|
ajeshrn
New User
Joined: 25 Mar 2009 Posts: 78 Location: India
|
|
|
|
ashimer,
I guess we need to use both.With the below data
Org Id Institution Id
1 100
1 101
1 102
1 199
2 200
2 500
2 501
2 510
2 511
2 512
We need to fetch the maximum and minimum in a particular range.I am not sure whether this is doable using a single query. |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hello,
Quote: |
2 200,500-501,510-512 |
Why are there 2 "ranges" in the 500 series? I believe i understand, but this has not been explained.
Quote: |
I am not sure whether this is doable using a single query. |
Probably not. . . |
|
Back to top |
|
|
|