Reply from Alonso_mx on Nov 15 at 10:53 AM I?m not sure if its possible to do many operations like you wish, but firts at all in the query you have to remove the commas for the fields that you want to select. 2th maybe you can try to change the field in COUNT, if you field CONNID is unique then try count this field, 3th the "( CONNID )"must be separated with a blank space of the words and 4th you have to decide if its a SELECT SINGLE or a normal SELECT because if you use SELECT then is mandatory that you use INTO TABLE, else you can use INTO ( Var1, Var2, Var2) i suggest that make the normal query and before make the calculations. for example: SELECT CONNID LUGGWEIGHT INTO TABLE IT_SBOOK FROM SBOOK WHERE CARRID = 'LH' AND FLDATE = '19590228' GROUP BY CONNID. DESCRIBE IT_SBOOK INTO VL_COUNT. "For count all records if you want the unique CONNID is necesary that you use an auxiliar table: IT_SBOOK_AUX = IT_SBOOK. DELETE ADJACENT DUPLICATES IT_SBOOK_AUX COMPARING CONNID. DESCRIBE IT_SBOOK_AUX INTO VL_COUNT. "For count all records And then you can make the de another two operations with a loop. i hope it is useful. Regards 2017-11-15 6:17 GMT-06:00 handsome1234 email@removed: > Question from handsome1234 on Nov 15 at 7:21 AM > Simple code get error :report this error: > If the new Open SQL syntax is used, it must be used throughout. This > includes using @ to escape host variables. > code: > TABLES SBOOK. > DATA: AACOUNT TYPE I,AASUM TYPE P DECIMALS 2,AAAVG TYPE F. > DATA: CONNID LIKE SBOOK-CONNID. > SELECT CONNID, COUNT(*), SUM(LUGGWEIGHT), AVG(LUGGWEIGHT) INTO > (CONNID,AACOUNT,AASUM,AAAVG) > FROM SBOOK > WHERE > CARRID = 'LH' AND FLDATE = '19590228' > GROUP BY CONNID. > WRITE: / CONNID,AACOUNT,AASUM,AAAVG. > CHECK AASUM > 10. > WRITE: / ' THE SUM WEITHT>10'. > ENDSELECT . > > *Reply to this email* to post your response.
| | | ---------------Original Message--------------- From: handsome1234 Sent: Wednesday, November 15, 2017 7:21 AM Subject: Report this Error: If the new Open SQL Syntax is used, it Must be used Throughout Simple code get error :report this error: If the new Open SQL syntax is used, it must be used throughout. This includes using @ to escape host variables. code: TABLES SBOOK. DATA: AACOUNT TYPE I,AASUM TYPE P DECIMALS 2,AAAVG TYPE F. DATA: CONNID LIKE SBOOK-CONNID. SELECT CONNID, COUNT(*), SUM(LUGGWEIGHT), AVG(LUGGWEIGHT) INTO (CONNID,AACOUNT,AASUM,AAAVG) FROM SBOOK WHERE CARRID = 'LH' AND FLDATE = '19590228' GROUP BY CONNID. WRITE: / CONNID,AACOUNT,AASUM,AAAVG. CHECK AASUM > 10. WRITE: / ' THE SUM WEITHT>10'. ENDSELECT . | | Reply to this email to post your response. __.____._ | In the Spotlight Become a blogger at Toolbox.com and share your expertise with the community. Start today. _.____.__ |