Current Position:Home > Aggregate in SELECT query

Aggregate in SELECT query

Update:11-30Source: network consolidation
Advertisement
Hi All,
   Is it possible to manipulate(add, subtract,...) two fields belonging to two different tables in a SELECT query or JOIN statement.
   Ex. 
       SELECT
         <TABLE1>~<FIELD1>
         <TABLE1>~<FIELD2>
         <TABLE2>~<FIELD1>
         <TABLE1>~<FIELD2>
       INTO TABLE
         <RESULT_TAB>
       FROM
          <TABLE1>
        INNER JOIN
          <TABLE2>
        ON
          <TABLE1>~<FIELD1> = <TABLE2>~<FIELD1>  ...
  My problem is, while selecting can i add or subtract two fields say <TABLE1><FIELD1> and <TABLE2><FIELD1>.
Regards,
Mustajab.

The Best Answer

Advertisement
Hi Mustajab!
IMHO you can't manipulate two fields during the select (in open SQL).
If you are interested in sums (or differences) over all entries, then you can use the aggregation function SUM and make the final calculation with the total of the columns - but not line by line.
Regards,
Christian
  • How can i use SUM aggregate in select query? Update:11-30

    HI, GURUS, How can i use SUM function in Select Query and i want to store that value into itab. for ex: TABLES: vbap. types: begin of ty_vbap,        incluse type vbap,        sum type string,       end of ty_vbap. data: i_vbap type TABLE OF ty_vbap,

  • Aggregate in SELECT query Update:11-30

    Hi All,    Is it possible to manipulate(add, subtract,...) two fields belonging to two different tables in a SELECT query or JOIN statement.    Ex.         SELECT          <TABLE1>~<FIELD1>          <TABLE1>~<FIELD2>          <T

  • Select Query failing on a  table that has per sec heavy insertions. Update:10-11

    Hi Problem statement 1- We are using 11g as an database. 2- We have a table that is partitioned on the date as range partition. 3- The insertion of data is very high.i.e. several hundreds records per sec. in the current partitioned. 4- The data is co

  • SELECT query takes too much time! Y? Update:10-11

    Plz find my SELECT query below: select w~mandt wvbeln wposnr wmeins wmatnr wwerks wnetwr wkwmeng wvrkme wmatwa wcharg w~pstyv wposar wprodh wgrkor wantlf wkztlf wlprio wvstel wroute wumvkz wumvkn wabgru wuntto wawahr werdat werzet wfixmg wprctr wvpma

  • Regarding to perform in select query Update:11-30

    could any tell  the select query in this piece of code would affect the performance of the programe DATA: BEGIN OF OUTREC,       BANKS LIKE BNKA-BANKS,       BANKL LIKE BNKA-BANKL,       BANKA LIKE BNKA-BANKA,       PROVZ LIKE BNKA-PROVZ,   "Region (

  • Basic query regarding work-area and select query Update:11-30

    hi dear sdn members, thanks too all for solving all my query's up till now i am stuck in a problem need help 1)  why basically work-area has been used ? the sole purpose 2)  different types of select query ? only coding examples note: no links pls re

  • Concatenate name in select query... Update:11-30

    Hi Pals, I was wondering how to directly concetenate client name in the select query itself... Currently the code says : SELECT SINGLE NAME1 NAME2            INTO (V_NAME1,V_NAME2)            FROM KNA1            WHERE KUNNR = I_PROJ-ZZCLIENT. CONCAT

  • Aggregate sql select Update:11-30

    Hi, I'm in Oracle 11g, need some help writing aggregate sql select. That might be really easy I hope. We are doing some web analytics and counting clicks on a company’s web site, so I have to count sums on clicks, visitors and sessions from activity

  • MDO SELECT Query Update:11-30

    Hi, When I try to do select query on MDO objects, I could see there are many restriction in executing the SELECT statement unlike doing with traditional database. For example, I am not able to use any of the aggregate function (like sum, count, avera

  • Questions on the most efficient select query.. Update:11-30

    What is the difference between the two select query & please explain y is the 2nd select query more efficient?? DATA: MAX_MSGNR type t100-msgnr. MAX_MSGNR = '000'. SELECT * FROM T100 INTO T100_WA   WHERE SPRSL = 'D' AND         ARBGB = '00'.   CHECK: