Hi,
this gives me an sqlstt of 42908
The problem is that the SUM() - column is not named.
Just change the SQL statement as follows:
CREATE TABLE TST/TESTJJ 
    AS (SELECT ahaPDL, AHAPNO, AHBSNO, aHBSDT, AHBQTY,
               sum(AHXLABHR) as SumLABHR
           FROM cat/ah 
           WHERE     ahapdl in ('106','425','426') 
                 and ahpno LIKE 'LABOR%' 
                 and ahxctype = '1' 
           GROUP BY ahaPDL, AHAPNO, AHBSNO,  aHBSDT, AHBQTY 
           ORDER BY ahaPDL, AHAPNO, AHBSNO, aHBSDT, AHBQTY ) 
WITH DATA  
or   
CREATE TABLE TST/TESTJJ 
       (ahaPDL, AHAPNO, AHBSNO, aHBSDT, AHBQTY, SumLABHR) 
    AS (SELECT ahaPDL, AHAPNO, AHBSNO, aHBSDT, AHBQTY, sum(AHXLABHR)
           FROM cat/ah 
           WHERE     ahapdl in ('106','425','426') 
                 and ahpno LIKE 'LABOR%' 
                 and ahxctype = '1' 
           GROUP BY ahaPDL, AHAPNO, AHBSNO,  aHBSDT, AHBQTY 
           ORDER BY ahaPDL, AHAPNO, AHBSNO, aHBSDT, AHBQTY ) 
WITH DATA  
Mit freundlichen Grüßen / Best regards
Birgitta Hauser
"Shoot for the moon, even if you miss, you'll land among the stars." (Les
Brown)
"If you think education is expensive, try ignorance." (Derek Bok)
"What is worse than training your staff and losing them?  Not training them
and keeping them!"
-----Ursprüngliche Nachricht-----
Von: midrange-l-bounces@xxxxxxxxxxxx
[mailto:midrange-l-bounces@xxxxxxxxxxxx] Im Auftrag von
JDHorn@xxxxxxxxxxxxxx
Gesendet: Tuesday, July 29, 2008 22:42
An: midrange-l@xxxxxxxxxxxx
Betreff: Way to get STRSQL SELECT to run in batch?
   I can't seem to get the create table as function to work with a group by
    
   Way to get STRSQL SELECT to run in batch?
   this works just fine
   CREATE TABLE TST/TESTJJ AS (SELECT AHAPDL, AHAPNO, AHBSNO, A
   HBSDT, AHBQTY  FROM   CAT/AH WHERE (AHAPDL IN ('106','425','
   426')) AND (AHPNO LIKE  'LABOR%') AND (AHXCTYPE = '1')) WITH
    DATA   
    
   this gives me an sqlstt of  42908
   CREATE TABLE TST/TESTJJ AS (SELECT ahaPDL, AHAPNO, AHBSNO, aHBSDT,
AHBQTY,
   sum(AHXLABHR) FROM 
   cat/ah WHERE (ahapdl in ('106','425','426')) and (ahpno LIKE      
   'LABOR%') and (ahxctype = '1') GROUP BY ahaPDL, AHAPNO, AHBSNO,   
   aHBSDT, AHBQTY ORDER BY ahaPDL, AHAPNO, AHBSNO, aHBSDT, AHBQTY ) WITH
    DATA     
    
   any ideas?
                                                    
   Jim Horn
   This email is intended only for the person or entity  
   to which it is addressed and may contain information  
   that is privileged, confidential or otherwise protected  
   from disclosure. If you are not the named addressee  
   or an employee or agent responsible for delivering  
   this message to the named addressee, you are not
   authorized to read, print, retain copy, and disseminate
   this message or any part of it. If you have received this
   message in error please notify us immediately by email,
   discard any paper copies and delete all electronic files  
   of this message.
As an Amazon Associate we earn from qualifying purchases.