IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Combine two queries having 'distinct' & 'max' functions


IBM Mainframe Forums -> DB2
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
banand

New User


Joined: 05 Jun 2007
Posts: 28
Location: Mumbai

PostPosted: Tue Oct 07, 2008 4:29 pm
Reply with quote

Hi

I want to combine two queries in to one query.Please suggest me whether it is possible. if so how? below are the two queries.
==========================================
select VALUE(MAX(CLASS_ROLL_NO),0),VALUE(MAX(CLASS_TAB_NO),0)
INTO :CLACE.ROLL_NO,
:CLACE.TAB_NO
FROM CLASS_TABLE
WHERE CLASS_CD=:CLACE.CLASS_CD
==========================================
SELECT DISTINCT(CLASS_MEM)
INTO :CLACE.CLASS_MEM
FROM CLASS_TABLE
WHERE CLASS_CD=:CLACE.CLASS_CD
===========================================
Back to top
View user's profile Send private message
anandinmainframe

Active User


Joined: 31 May 2007
Posts: 171
Location: India

PostPosted: Wed Oct 08, 2008 9:06 am
Reply with quote

Hi Bala,
select VALUE(MAX(CLASS_ROLL_NO),0),VALUE(MAX(CLASS_TAB_NO),0),
DISTINCT(CLASS_MEM)
INTO :CLACE.ROLL_NO,
:CLACE.TAB_NO,
:CLACE.CLASS_MEM
FROM CLASS_TABLE
WHERE CLASS_CD=:CLACE.CLASS_CD

i hope it will work
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> DB2

 


Similar Topics
Topic Forum Replies
No new posts SQLCODE = -122 while using the scalar... DB2 4
No new posts DSNTIAUL and DB2 Scalar Functions DB2 17
No new posts Trying to use sort to do two function... DFSORT/ICETOOL 14
No new posts Using SPUFI with DISTINCT and MAX is ... DB2 8
No new posts Index related queries DB2 5
Search our Forums:

Back to Top