MVSFORUMS.com Forum Index MVSFORUMS.com
A Community of and for MVS Professionals
 
 FAQFAQ   SearchSearch   Quick Manuals   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

SPUFI display col from 'and exists' result from same table

 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Database
View previous topic :: View next topic  
Author Message
bstillwa
Beginner


Joined: 01 Nov 2004
Posts: 23
Topics: 6
Location: NJ

PostPosted: Thu Jan 18, 2007 12:52 pm    Post subject: SPUFI display col from 'and exists' result from same table Reply with quote

I have the following SQL I am running in SPUFI. It works fine, but I would also like to display B.REL_VER_NUM. Can someone please show me how to change this statement so I can display the extra column?
Code:

SELECT                                                               
         ERR_NUM                                                       
        ,ERR_SUB_NUM                                                   
        ,REL_VER_NUM                                                   
  FROM DV01.EET A                                                       
   WHERE A.REL_VER_NUM < '170'                   
     AND EXISTS (SELECT ERR_NUM, ERR_SUB_NUM, REL_VER_NUM               
                   FROM DV01.EET B                                     
                  WHERE (B.ERR_NUM = A.ERR_NUM                         
                     AND B.ERR_SUB_NUM = A.ERR_SUB_NUM                 
                     AND B.REL_VER_NUM > A.REL_VER_NUM                 
                     AND B.REL_VER_NUM <= '170')   
                 )

_________________
Bev.
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12376
Topics: 75
Location: San Jose

PostPosted: Thu Jan 18, 2007 1:32 pm    Post subject: Reply with quote

bstillwa,

Try this


Code:

SELECT A.ERR_NUM
      ,A.ERR_SUB_NUM
      ,A.REL_VER_NUM
      ,B.REL_VER_NUM
  FROM DV01.EET A
      ,DV01.EET B
 WHERE A.REL_VER_NUM  < '170'
   AND B.REL_VER_NUM  <= '170'
   AND B.ERR_NUM      = A.ERR_NUM
   AND B.ERR_SUB_NUM  = A.ERR_SUB_NUM
   AND B.REL_VER_NUM  > A.REL_VER_NUM


Hope this helps...

Cheers

Kolusu
_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
bstillwa
Beginner


Joined: 01 Nov 2004
Posts: 23
Topics: 6
Location: NJ

PostPosted: Thu Jan 18, 2007 1:45 pm    Post subject: Reply with quote

Thanks, and I will try that, but in the meantime I got what I wanted by coding this (and can u plz tell me how to get this to look like code in this forum, I tried to use the Code button but does not work for me):
Code:
SELECT                                                       
   A.ERR_NUM                                                 
  ,A.ERR_SUB_NUM                                             
  ,A.REL_VER_NUM AS OBS_REL_VER_NUM                           
  ,C.REL_VER_NUM AS PROD_REL_VER_NUM                         
FROM DV01.EET A                                               
    ,DV01.EET C                                               
 WHERE A.REL_VER_NUM < '170'                                 
   AND EXISTS (SELECT B.ERR_NUM, B.ERR_SUB_NUM, B.REL_VER_NUM
                 FROM DV01.EET B                             
                WHERE (B.ERR_NUM = A.ERR_NUM                 
                   AND B.ERR_SUB_NUM = A.ERR_SUB_NUM         
                   AND B.REL_VER_NUM > A.REL_VER_NUM         
                   AND B.REL_VER_NUM <= '170')               
               )                                             
  AND A.ERR_NUM     = C.ERR_NUM                               
  AND A.ERR_SUB_NUM = C.ERR_SUB_NUM                           
  AND A.REL_VER_NUM <> C.REL_VER_NUM                         
  AND C.REL_VER_NUM <= '170'                                 

_________________
Bev.
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12376
Topics: 75
Location: San Jose

PostPosted: Thu Jan 18, 2007 1:51 pm    Post subject: Reply with quote

bstillwa,

You have opted to Disable BBCode in this post when you are posting. It is below the post reply box. I removed that

Aren't you using the Quick reply box which is below ?

Kolusu
_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
bstillwa
Beginner


Joined: 01 Nov 2004
Posts: 23
Topics: 6
Location: NJ

PostPosted: Thu Jan 18, 2007 2:29 pm    Post subject: Reply with quote

Thanks kolusu, your answer is simpler than mine and works just as well!
I was not using the Quick Reply box. If we should use that then why are two "postreply" buttons supplied both top and bottom of message? I guess I just don't post often enough to know all these tricks. Suggestion would be to add a button here on How to Post and Reply (for newbies and infrequent users). There is skimpy info in FAQ.
Thanks again.
_________________
Bev.
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12376
Topics: 75
Location: San Jose

PostPosted: Thu Jan 18, 2007 2:43 pm    Post subject: Reply with quote

Quote:

If we should use that then why are two "postreply" buttons supplied both top and bottom of message?


Well Quick reply is saves 1 additional click and you have the option of reading all the posts above. Also it has some other cool features which are explained here

http://www.mvsforums.com/helpboards/viewtopic.php?t=363

Kolusu
_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Database All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


MVSFORUMS
Powered by phpBB © 2001, 2005 phpBB Group