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
 

 

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

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DB2
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    Post subject: Combine two queries having 'distinct' & 'max' functions
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    Post subject: Reply to: Combine two queries having 'distinct' & 'max'
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    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 Row-Numbers of distinct rows? Auryn DB2 1 Thu Oct 20, 2016 4:38 pm
No new posts Regd Date Functions in Syncsort muralikrishnan_new SYNCSORT 2 Fri Jul 01, 2016 8:21 pm
No new posts Combine columns without breaking words Indrajit_57 SYNCSORT 1 Sat Mar 19, 2016 9:33 am
No new posts Running queries against OLTP Database A_programmers DB2 3 Tue Jul 14, 2015 4:51 pm
No new posts Selective execution of a queries Delip DB2 9 Fri Jan 16, 2015 3:51 pm


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