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 

SQL error at or before <EMPTY> ???

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


Joined: 10 Feb 2006
Posts: 188
Topics: 68

PostPosted: Sat Jan 20, 2007 8:38 pm    Post subject: SQL error at or before <EMPTY> ??? Reply with quote

Can anyone tell me what the cause of the SQL error is below ?

Code:
SELECT CONCAT_KEY,                             
  COUNT(*)                                     
FROM (SELECT DIST_NUMBER||AGT_NUMBER||AGT_INDEX
  AS CONCAT_KEY                                 
  FROM H2591DB.TCSAU_EVMA                       
  WHERE STATE = '20'                           
  AND GENERAL_STATUS = '1'                     
  AND REASON_GENERAL IN ('A','B')               
  AND DIST_NUMBER = 'ERP')                     
GROUP BY CONCAT_KEY;             


QUERY MESSAGES:
SQL error at or before <EMPTY> (line 9, position 27).















QUERY MESSAGES:
SQL error at or before <EMPTY> (line 9, position 27).
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: Sat Jan 20, 2007 9:39 pm    Post subject: Reply with quote

tcurrier,

You need to qualify the temp result table. Try this

Code:

SELECT A.CONCAT_KEY                             
      ,COUNT(*)                                     
  FROM (SELECT DIST_NUMBER||AGT_NUMBER||AGT_INDEX
            AS CONCAT_KEY
          FROM H2591DB.TCSAU_EVMA
         WHERE STATE           = '20'
           AND GENERAL_STATUS  = '1'
           AND REASON_GENERAL IN ('A','B')
           AND DIST_NUMBER     = 'ERP') A
  GROUP BY A.CONCAT_KEY;


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
tcurrier
Intermediate


Joined: 10 Feb 2006
Posts: 188
Topics: 68

PostPosted: Sat Jan 20, 2007 10:58 pm    Post subject: Reply with quote

Thank you very much ! I've used DB2/SQL before, but not with this combination of concatenated fields and the 'group by' clause. This one was driving me nuts.

Thanks again !
Back to top
View user's profile Send private message
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