Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

Maximum and Minimum Value fetch

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DB2
View previous topic :: :: View next topic  
Author Message
ajeshrn

New User


Joined: 25 Mar 2009
Posts: 78
Location: India

PostPosted: Tue Aug 25, 2009 11:51 am    Post subject: Maximum and Minimum Value fetch
Reply with quote

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? icon_rolleyes.gif
Back to top
View user's profile Send private message

Ketan Varhade

Active User


Joined: 29 Jun 2009
Posts: 197
Location: Mumbai

PostPosted: Tue Aug 25, 2009 12:17 pm    Post subject:
Reply with quote

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
View user's profile Send private message
ajeshrn

New User


Joined: 25 Mar 2009
Posts: 78
Location: India

PostPosted: Tue Aug 25, 2009 12:23 pm    Post subject:
Reply with quote

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
View user's profile Send private message
ashimer

Active Member


Joined: 13 Feb 2004
Posts: 551
Location: Bangalore

PostPosted: Tue Aug 25, 2009 1:18 pm    Post subject:
Reply with quote

Quote:

100-102,199


MAx and Min value fetch - what applies here ?
Back to top
View user's profile Send private message
ajeshrn

New User


Joined: 25 Mar 2009
Posts: 78
Location: India

PostPosted: Tue Aug 25, 2009 1:51 pm    Post subject:
Reply with quote

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
View user's profile Send private message
dick scherrer

Site Director


Joined: 23 Nov 2006
Posts: 19270
Location: Inside the Matrix

PostPosted: Tue Aug 25, 2009 7:33 pm    Post subject:
Reply with quote

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
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DB2 All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts CA-Endevor Admin - 3 years minimum vasanthz Mainframe Jobs 0 Tue Apr 04, 2017 5:36 am
No new posts Multi row fetch - "for read only... Nileshkul DB2 3 Sun Aug 14, 2016 12:52 am
No new posts JCL to fetch schedule status from act... parasmalik20 CA Products 1 Thu Jun 02, 2016 7:11 pm
No new posts What is the maximum number of sort wo... Pravina M SYNCSORT 2 Mon Mar 14, 2016 4:51 pm
No new posts ABEND due to FETCH FAILED jackzhang75 ABENDS & Debugging 17 Thu Mar 10, 2016 3:08 am


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us