How get the sum of differences in time

I have the query to get the taken (duration) of time to perform each activity below


Select (select ep.name PE env_mapping where ep.id = p.bsa_env_id) environment,
(Select trunc ((Max (ps.actual_end) - Min (ps.actual_start)) * 24 * 60) of ps Highlevel_activity where ps.activity_ID = p.id and ps.out_of_window_flag =' no. "") Actual_duration,
(select nvl (trunc ((max (de.actual_end) - min (de.actual_start)) * 24 * 60), '0') Detail_activity time_taken, ps Highlevel_activity where de.task_type = 'Apps Patching"and ps.activity_id = p.id and.) Highlevel_activity_id = ps.id and ps. OUT_OF_WINDOW_FLAG = ' NO') Apps_Patching,.
(select nvl (trunc ((max (de.actual_end) - min (de.actual_start)) * 24 * 60), '0') Detail_activity time_taken, Highlevel_activity ps where de.task_type = ' Patching DB/MT ' and ps.activity_id = p.id and.) Highlevel_activity_id = ps.id and ps. OUT_OF_WINDOW_FLAG = ' NO') DB_MT_Patching,.
(select nvl (trunc ((max (de.actual_end) - min (de.actual_start)) * 24 * 60), '0') Detail_activity time_taken, ps Highlevel_activity where de.task_type = 'Shut Down' and ps.activity_id = p.id and.) Highlevel_activity_id = ps.id and ps. OUT_OF_WINDOW_FLAG = ' NO') Shut_Down,.
(select nvl (trunc ((max (de.actual_end) - min (de.actual_start)) * 24 * 60), '0') Detail_activity time_taken, ps Highlevel_activity where de.task_type = 'Start Up' and ps.activity_id = p.id and.) Highlevel_activity_id = ps.id and ps. OUT_OF_WINDOW_FLAG = ' NO') Start_Up,.
(select nvl (trunc ((max (de.actual_end) - min (de.actual_start)) * 24 * 60), '0') Detail_activity time_taken, ps Highlevel_activity where de.task_type = 'Vérification' and ps.activity_id = p.id and.) Highlevel_activity_id = ps.id and ps. OUT_OF_WINDOW_FLAG = 'NO') audit.
(select nvl (trunc ((max (de.actual_end) - min (de.actual_start)) * 24 * 60), '0') Detail_activity time_taken, ps Highlevel_activity where de.task_type = 'Patching meadow' and ps.activity_id = p.id and.) Highlevel_activity_id = ps.id and ps. OUT_OF_WINDOW_FLAG = ' NO') Pre_Patching,.
(select nvl (trunc ((max (de.actual_end) - min (de.actual_start)) * 24 * 60), '0') Detail_activity time_taken, ps Highlevel_activity where de.task_type = 'Patching Post' and ps.activity_id = p.id and.) Highlevel_activity_id = ps.id and ps. OUT_OF_WINDOW_FLAG = ' NO') Post_Patching,.
(select nvl (trunc ((max (de.actual_end) - min (de.actual_start)) * 24 * 60), '0') Detail_activity time_taken, ps Highlevel_activity where de.task_type = 'Others' and ps.activity_id = p.id and.) Highlevel_activity_id = ps.id and ps. OUT_OF_WINDOW_FLAG = 'NO') others

activity p where

I get the output as below

EnV1 27 April 13 167 54 29 29 15 0 0 67 0
EnV2 may 3 13 10 20 05 05 0 0 50 0 33


My requirement is to get the amount for each column which I get on top of the query. How can I change the query above to get as the result below


EnV1 27 April 13 167 54 29 29 15 0 0 67 0
EnV2 may 3 13 10 20 05 05 0 0 50 0 33
177 74 34 34 15 50 67 33 total

Please help

Thank you
Archana

Hello

Agowda wrote:
I have the query to get the taken (duration) of time to perform each activity below

Select (select ep.name PE env_mapping where ep.id = p.bsa_env_id) environment,
(Select trunc ((Max (ps.actual_end) - Min (ps.actual_start)) * 24 * 60) of ps Highlevel_activity where ps.activity_ID = p.id and ps.out_of_window_flag =' no. "") Actual_duration,
(select nvl (trunc ((max (de.actual_end) - min (de.actual_start)) * 24 * 60), '0') Detail_activity time_taken, ps Highlevel_activity where de.task_type = 'Apps Patching"and ps.activity_id = p.id and.) Highlevel_activity_id = ps.id and ps. OUT_OF_WINDOW_FLAG = ' NO') Apps_Patching,.


(select nvl (trunc ((max (de.actual_end) - min (de.actual_start)) * 24 * 60), '0') Detail_activity time_taken, Highlevel_activity ps where de.task_type = ' Patching DB/MT ' and ps.activity_id = p.id and.) Highlevel_activity_id = ps.id and ps. OUT_OF_WINDOW_FLAG = ' NO') DB_MT_Patching,.
(select nvl (trunc ((max (de.actual_end) - min (de.actual_start)) * 24 * 60), '0') Detail_activity time_taken, ps Highlevel_activity where de.task_type = 'Shut Down' and ps.activity_id = p.id and.) Highlevel_activity_id = ps.id and ps. OUT_OF_WINDOW_FLAG = ' NO') Shut_Down,.
(select nvl (trunc ((max (de.actual_end) - min (de.actual_start)) * 24 * 60), '0') Detail_activity time_taken, ps Highlevel_activity where de.task_type = 'Start Up' and ps.activity_id = p.id and.) Highlevel_activity_id = ps.id and ps. OUT_OF_WINDOW_FLAG = ' NO') Start_Up,.
(select nvl (trunc ((max (de.actual_end) - min (de.actual_start)) * 24 * 60), '0') Detail_activity time_taken, ps Highlevel_activity where de.task_type = 'Vérification' and ps.activity_id = p.id and.) Highlevel_activity_id = ps.id and ps. OUT_OF_WINDOW_FLAG = 'NO') audit.
(select nvl (trunc ((max (de.actual_end) - min (de.actual_start)) * 24 * 60), '0') Detail_activity time_taken, ps Highlevel_activity where de.task_type = 'Patching meadow' and ps.activity_id = p.id and.) Highlevel_activity_id = ps.id and ps. OUT_OF_WINDOW_FLAG = ' NO') Pre_Patching,.
(select nvl (trunc ((max (de.actual_end) - min (de.actual_start)) * 24 * 60), '0') Detail_activity time_taken, ps Highlevel_activity where de.task_type = 'Patching Post' and ps.activity_id = p.id and.) Highlevel_activity_id = ps.id and ps. OUT_OF_WINDOW_FLAG = ' NO') Post_Patching,.
(select nvl (trunc ((max (de.actual_end) - min (de.actual_start)) * 24 * 60), '0') Detail_activity time_taken, ps Highlevel_activity where de.task_type = 'Others' and ps.activity_id = p.id and.) Highlevel_activity_id = ps.id and ps. OUT_OF_WINDOW_FLAG = 'NO') others

activity p where

If you make 9 of subqueries to get 9 different columns. It is very inefficient, and it is also difficult to maintain. If you need to change the conditions in subqueries, you will need to do the exact same change at 9 different locations.
It would be much more effective if you just add de.task_type to the GROUP BY clause and then rotates the results. He could not run 9 times faster, but it probably run 5 times faster.
See the FAQ forum {message identifier: = 9360005} to find out how.

I get the output as below

EnV1 27 April 13 167 54 29 29 15 0 0 67 0
EnV2 may 3 13 10 20 05 05 0 0 50 0 33

My requirement is to get the amount for each column which I get on top of the query. How can I change the query above to get as the result below

EnV1 27 April 13 167 54 29 29 15 0 0 67 0
EnV2 may 3 13 10 20 05 05 0 0 50 0 33
177 74 34 34 15 50 67 33 total

It's a GROUPING DEFINED work, no ACCUMULATION.

Since you post CREATE TABLE and INSERT statemennts for your sample data, I will use the hr.departments table to show the difference.
When you GROUP BY N > 1 the expressions, ROLLUP gives you N + 1 levels of totals and subtotals. For example:

SELECT       department_id
,       job_id
,       SUM (salary)     AS total_sal
FROM       hr.employees
GROUP BY  ROLLUP (department_id, job_id)
ORDER BY  department_id, job_id
;

The above query GROUPs BY s expressions (department_id job_id) so ROLLUP produces 3 sorts of totals:
(1) total department_id and job_id (e.g. 13000 for department_id = 20 and job_id = "Fatyty" below)
(2) total Department, including all of the work (e.g. 6000 = 19000 13000 + for department_id = 20) and
(3) total general for the entire result (e.g. 691416)

DEPARTMENT_ID JOB_ID      TOTAL_SAL
------------- ---------- ----------
           10 AD_ASST          4400
           10                  4400
           20 MK_MAN          13000
           20 MK_REP           6000
           20                 19000
           30 PU_CLERK        13900
           30 PU_MAN          11000
           30                 24900
           40 HR_REP           6500
           40                  6500
           50 SH_CLERK        64300
           50 ST_CLERK        55700
           50 ST_MAN          36400
           50                156400
           60 IT_PROG         28800
           60                 28800
           70 PR_REP          10000
           70                 10000
           80 SA_MAN          61000
           80 SA_REP         243500
           80                304500
           90 AD_PRES         24000
           90 AD_VP           34000
           90                 58000
          100 FI_ACCOUNT      39600
          100 FI_MGR          12008
          100                 51608
          110 AC_ACCOUNT       8300
          110 AC_MGR          12008
          110                 20308
              SA_REP           7000
                               7000
                             691416

You don't want all that: you just want what corresponds in total for each department_id and job_id and total general, without any level of iintermediate. Here's how you can achieve these results using GROUPING SETS instead of ROLLUP:

SELECT       department_id
,       job_id
,       SUM (salary)     AS total_sal
FROM       hr.employees
GROUP BY  GROUPING SETS ( (department_id, job_id)
               , ()
               )
ORDER BY  department_id, job_id
;
DEPARTMENT_ID JOB_ID      TOTAL_SAL
------------- ---------- ----------
           10 AD_ASST          4400
           20 MK_MAN          13000
           20 MK_REP           6000
           30 PU_CLERK        13900
           30 PU_MAN          11000
           40 HR_REP           6500
           50 SH_CLERK        64300
           50 ST_CLERK        55700
           50 ST_MAN          36400
           60 IT_PROG         28800
           70 PR_REP          10000
           80 SA_MAN          61000
           80 SA_REP         243500
           90 AD_PRES         24000
           90 AD_VP           34000
          100 FI_ACCOUNT      39600
          100 FI_MGR          12008
          110 AC_ACCOUNT       8300
          110 AC_MGR          12008
              SA_REP           7000
                             691416

I hope that answers your question.
If this isn't the case, post CREATE TABLE and INSERT statements for some examples of data and the results desired from these data.
Simplify the problem. For example, instead of 9 different task_types, post sample data and results for 3 task_types. Simply mention that you actually 9, and we will find a solution that can be easily adapted for 9.
Always say what version of Oracle you are using (for example, 11.2.0.2.0).
See the FAQ forum {message identifier: = 9360002}

Published by: Frank Kulash on May 27, 2013 10:47

Tags: Database

Similar Questions

  • How can I get the clips in record full-time instead of the 25seconds (which seems to be set) when using windows DVD maker

    How can I get the clips in record full-time instead of 25 seconds (that they seem to be defined) using windows DVD maker

    Hi LorraineDawson,

    Here's a walkthough troubleshooting on this issue:

    http://Windows.Microsoft.com/en-us/Windows-Vista/troubleshoot-problems-with-creating-a-DVD-video-using-Windows-DVD-Maker

    hope this helps

    B Eddie

  • How to get the sum of "(qty*rate) as salesValue 'as TotalSalesValue cust_id agenda?"

    Mr President.

    I have to take the column values from3, or 4 tables and two of them need to be multiplied, then get the sum of this value multiplied by using Group by and order clause.

    as below

    cust_id prod name Qty. rate value totalValue
    01one01500500
    01b024008001300

    How to get there

    Select

    cstmr.cust_id CustId,

    PRDT. Name AutoCAD,

    SL.sal_qty SalQty,

    SL.unit_sal_price UnitSalPrice,

    SL.sal_qty * SL.unit_sal_price as SalVal,

    Sum(SL.sal_qty*SL.unit_sal_price) as TotalSalesValue

    Of

    cstmr customer,

    salesLine sl,

    prdt product

    where

    PRDT.prod_id = sl.prod_id

    Group

    cstmr.cust_id,

    PRDT. Name,

    SL.sal_qty,

    SL.unit_sal_price

    order by

    cstmr.cust_id

    Concerning

    Your expected results include values that are not in your input data - there is no M.BOARD product, for example. This is an adaptation of Manik code that will give you the subtotals for each customer:

    SELECT client_name c.nom,

    product_name p.Name,

    SL.sal_qty,

    SL.unit_sal_price,

    SL.sal_qty * SL.unit_sal_price AS salesvalue,

    CASE

    WHEN ROW_NUMBER () OVER (partition by order of c.cust_id p.prod_id desc, sl.sal_id desc) = 1 THEN

    SUM (sl.sal_qty * sl.unit_sal_price) OVER (PARTITION BY c.cust_id)

    END totals

    FROM customer c INNER JOIN sales s ON s.cust_id = c.cust_id

    INNER JOIN salesline sl ON sl.sal_id = s.sal_id

    INNER JOIN product p ON p.prod_id = sl.prod_id

    ORDER BY c.cust_id, p.prod_id, sl.sal_id

    You could get the grand total of lines by the Union in a second query, or by doing something smart using ROLLUP. But I leave that to you because I think you should at least do some of your own homework.

  • How to get the sum of the first row in the previous row?

    Dear gurus... I need to get the sum of a column of the first row of my result set to the previous line based on a condition. I read analytical functions for this but they provide the sum of the first rank to Current Row through declaration "rows between Unbounded preceding and current line. Y at - it a statement that calculates the sum as "rows between Unbounded preceding and previous row?

    Hello

    kamranpathan wrote:
    Dear gurus... I need to get the sum of a column of the first row of my result set to the previous line based on a condition. I read analytical functions for this but they provide the sum of the first rank to Current Row through declaration "rows between Unbounded preceding and current line.

    If you do not explicitly give a windowing clause, then you get the default windowing clause you indicated.
    If you want another clause of windowing, ionclude in the analytic function call.

    Y at - it a statement that calculates the sum as "rows between Unbounded preceding and previous row?

    Yes. The correct syntax for "Previous rank" is «PREVIOUS 1»

    ...  ROWS BETWEEN  UNBOUNDED PRECEDING
                AND        1          PRECEDING
    

    For more information, search for "Analytic Functions" in the manual of the SQL language:
    http://download.Oracle.com/docs/CD/E11882_01/server.112/e17118/functions004.htm#sthref917

    I hope that answers your question.
    If not, post a small example of data (CREATE TABLE and only relevant columns, INSERT statements) for all tables and also post the results desired from these data.
    Explain, using specific examples, how you get these results from these data.
    Always tell what version of Oracle you are using.
    You will find the answers better faster if you always provide this information whenever you post a question.

    Published by: Frank Kulash, Sep 17, 2011 17:04
    I just saw Etbin responses.
    As usual, Etbin has a good point. If the column that you are basically cannot be NULL, then it is probably easier to subtract the total current line and use the default windowing clause.
    Even if it can be null, you find may be easier to use this approach.

  • Help! I get the same e-mail several times... my office to my blackberry?

    I get the same e-mail several times... my office to my blackberry?

    How do I rectify this?

    Try to re-sync and see if that solves the problem.  Your e-mail may be trapped and unable to move from the Outbox to the sent items - and re-synchronization can it empty.

    I hope this helps.

    Good luck!

    Lorien - MCSA/MCSE/network + / has + - if this post solves your problem, please click the 'Mark as answer' or 'Useful' button at the top of this message. Marking a post as answer, or relatively useful, you help others find the answer more quickly.

  • try to get the SUM of all of the charges with the having clause

    Hi Oracle users.

    I'm trying to accomplish to get a sum of a series of charges and it should be easy, but I can't get it.

    For example, I have the following.

    Select ACCTLOC,  count(ACCTLOC) AS TOTALP
    FROM BOX_ACCTS_TBL 
     WHERE TIME_REQ > SYSDATE-120
     Group By ACCTLOC
      having (count(ACCTLOC) > 1)
     
     the results are
     
    ACCTLOC   TOTALP
     
    Philly     15970
    NY          8623
    Tacoma        3
    SanFran     195
    Hartford    5
    Miami       4374
    
      
    

    How can I get the SUM of this group? Do I put this in PL SQL and do a procedure to carry out the selection? Is this the way to go on this?
    I appreciate all the comments you can give.

    Thank you!

    with

    query_result as

    (select 'Philly' acctloc, 15970 totalp Union double all the)

    Select "NY", 8623 Union double all the

    Select "Tacoma", 3 double Union all

    Select "SanFran", 195 double Union all

    Select "Hartford", 5 Union double all the

    Select 'Miami', double 4374

    )

    Select acctloc, totalp, sum (totalp) on the_sum, avg (totalp) (on the_avg), ratio_to_report (totalp) (percentages))

    of query_result

    ACCTLOC TOTALP THE_SUM THE_AVG PERCENTAGES
    Philly 15970 29170 4861.66666666666666666666666666666666667 .547480287967089475488515598217346588961
    NY 8623 29170 4861.66666666666666666666666666666666667 .295611930065135413095646211861501542681
    Tacoma 3 29170 4861.66666666666666666666666666666666667 .000102845389098388755570791909496057593
    SanFran 195 29170 4861.66666666666666666666666666666666667 .006684950291395269112101474117243743572
    Hartford 5 29170 4861.66666666666666666666666666666666667 .000171408981830647925951319849160095989
    Miami 4374 29170 4861.66666666666666666666666666666666667 .149948577305450805622214604045251971203

    Concerning

    Etbin

  • Hello, how get the permit numbers on site licenses (LWS), the identification number of the end user, nothing happens. Thank you

    Hello, how get the permit numbers on site licenses (LWS), the identification number of the end user, nothing happens. Thank you

    Since this is an open forum, not Adobe support... you must contact Adobe personnel to help

    Chat/phone: Mon - Fri 05:00-19:00 (US Pacific Time)<=== note="" days="" and="">

    Don't forget to stay signed with your Adobe ID before accessing the link below

    Creative cloud support (all creative cloud customer service problems)

    http://helpx.Adobe.com/x-productkb/global/service-CCM.html

  • Get the sum of all Member of a hierarchy.

    Hello
    I want to get the sum of each Member in a hierarchy.
    The hierarchy is defined in the strdet table:
    create table strdet
    (costcenterms varchar2(20),     // parent
    costcenterdet varchar2(20),    // child
    lev varchar2(1))
    The values for each object/material by costcenter (child) is defined in the details_det table:
    create table details_det
    (costcenterms varchar2(20),
    eppid varchar2(30) ,
    purchcontyear0 number(4,1) )
    Some examples of data:
    insert into strdet values ('1' , '1.1','2')
    /
    insert into strdet values ('1' , '1.2','2')
    /
    insert into strdet values ('1.1' , '1.1.1','3')
    /
    insert into strdet values ('1.1' , '1.1.2','3')
    /
    insert into strdet values ('1.2' , '1.2.1','3')
    /
    insert into strdet values ('1.2' , '1.2.2','3')
    /
    insert into strdet values ('1.2' , '1.2.3','3')
    /
    insert into strdet values ('1.1.1' , '1.1.1.1','4')
    /
    insert into strdet values ('1.1.1' , '1.1.1.2','4')
    /
    insert into strdet values ('1.1.2' , '1.1.2.1','4')
    /
    insert into strdet values ('1.2.1' , '1.2.1.1','4')
    /
    insert into strdet values ('1.2.1' , '1.2.1.2','4')
    /
    COMMIT;
    insert into details_det values('1.1.1.1','epp1',10);
    insert into details_det values('1.1.1.1','epp2',20);
    insert into details_det values('1.1.1.1','epp3',0);
    insert into details_det values('1.1.1.2','epp1',0);
    insert into details_det values('1.1.2.1','epp2',5);
    insert into details_det values('1.1.2.1','epp4',15);
    insert into details_det values('1.2.1.1','epp1',65);
    insert into details_det values('1.2.1.1','epp2',95);
    insert into details_det values('1.2.1.2','epp1',5);
    commit;
    The desired sql stmt output should be like this:
    costcenter             val
    --------------             ------
    1                        220
    1.1                       55
    1.2                     165
    1.1.1                    30
    1.1.2                    20
    1.2.1                  165
    I wrote the following, so far...
    SQL> select distinct s.costcenterms , sum(purchcontyear0) over(partition by s.costcenterms order by s.costcenterms)
      2        from details_det d , strdet s
      3        where s.costcenterdet=d.costcenterms(+)
      4        start with s.costcenterms='1'
      5             connect by  s.costcenterms = prior s.costcenterdet
      6        order by s.costcenterms
      7  /

    COSTCENTERMS                                                 SUM(PURCHCONTYEAR0)OVER(PARTIT
    ------------------------------------------------------------ ------------------------------
    1.2                                                         
    1.2.1                                                                                   165
    1.1.1                                                                                    30
    1.1.2                                                                                    20
    1                                                           
    1.1                                                         

    6 rows selected
    How should I modify the above sql stmt to get the result you want...?

    Note: I use OracleDB 10 g. v.2

    Thank you very much
    SIM

    sgalaxy wrote:
    Anyway, since I want to use the sql stmt to define a materialized view, all versions of data of hierarchical queries are not allowed... (oracle ora-30361 error...).

    No error on my:

    Connected to:
    Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production
    With the Partitioning, OLAP and Data Mining options
    
    SQL> create materialized view x_mv
      2  as
      3  select  grp,
      4          sum(purchcontyear0)
      5    from  (
      6           select  connect_by_root s.costcenterms grp,
      7                   d.purchcontyear0
      8             from  strdet s,
      9                   details_det d
     10                   where s.costcenterdet=d.costcenterms(+)
     11                   connect by s.costcenterms = prior s.costcenterdet
     12          )
     13    group by grp
     14  /
    
    Materialized view created.
    
    SQL> select  *
      2    from  x_mv
      3    order by grp
      4  /
    
    GRP                  SUM(PURCHCONTYEAR0)
    -------------------- -------------------
    1                                    215
    1.1                                   50
    1.1.1                                 30
    1.1.2                                 20
    1.2                                  165
    1.2.1                                165
    
    6 rows selected.
    
    SQL> 
    

    SY.

  • How get the resource group in the application model by local current-based program?

    Hi all


    We use JDeveloper Studio Edition Version 12.1.3.0.0 and deployed on GlassFish Server Open Source Edition 3.1.2.2 (build 5) and connect to the SQLServer database.


    How get the resource group in the application model by local current-based program?

    We have two local unions; En and Ar.

    -Resource Bundle for Arabic: ModelBundle_ar.properties

    -Bundle resources for English: ModelBundle_en.properties

    We try to use the code but the room below is still in English

    ResourceBundleDef resourceDef = this.getResourceBundleDef ();

    Settings regional locale = this.getDBTransaction () .getSession () .getLocale (); How to change the locale in the session?

    Dim retVal =

    StringManager.getLocalizedStringFromResourceDef (resourceDef, key,

    local, NULL, null,

    (false);

    Also, this is the code that I use when changing the local at the bean:

    Locale newLocale = new local (local);

    FacesContext context = FacesContext.getCurrentInstance ();

    context.getViewRoot () .setLocale (newLocale);

    refreshPage();



    Settings regional locale = this.getDBTransaction () .getSession () .getLocale (); How to change the locale in the session?

    This will return a locale for db connection.

    Instead, try with: ADFContext.getCurrent () .getLocale)

    Dario

  • I had a power failure and I learned today that there is a problem with the cache and I need to go to Preferences, purge the cache. I did this, but get the same error message every time I open the subsequent times of bridge.

    I had a power failure and I learned today that there is a problem with the cache and I need to go to Preferences, purge the cache. I did this, but get the same error message every time I open the subsequent times of bridge.

    Mac or PC? Version of the OS? What version of CS?

    Have you tried to reset the bridge? CTRL (Windows) / Opt (Mac) + click on the bridge to start icon and select open boxes.

    Otherwise, you could manually delete the cache, but we need to know the answers to questions to say where he is.

  • to get the sum of the balance_due

    Hi all


    I have this request with me
    SELECT   rac.customer_number, rac.customer_name,
                       su.LOCATION contract, SUBSTR (sa.NAME, 1, 2) bu,
                       ra.purchase_order_date sub_date,
                       ra.invoice_currency_code ccy,RA.PURCHASE_ORDER,ra.trx_number,
                       TRUNC (rad.gl_date) gl_date,
                       SUM
                          (npar_get_invoice_balance (ra.customer_trx_id,
                                                     '08-Sep-2011'
                                                    )
                          ) balance_due
                  FROM ra_customer_trx_all ra,
                       ra_site_uses_all su,
                       ra_cust_trx_line_gl_dist_all rad,
                       ra_customers rac,
                       ra_cust_trx_types_all ty,
                       ra_salesreps_all sa
                 WHERE TRUNC (rad.gl_date) <= '08-Sep-2011'
                   AND ra.bill_to_customer_id = rac.customer_id
                   AND su.site_use_code = 'BILL_TO'
                   AND su.site_use_id = ra.bill_to_site_use_id
                   AND ty.cust_trx_type_id = ra.cust_trx_type_id
                   AND ty.TYPE = 'INV'
                   AND ty.org_id <> -3113
                   AND rad.customer_trx_id = ra.customer_trx_id
                   AND rad.account_class = 'REC'
                   AND rad.latest_rec_flag = 'Y'
                   AND npar_get_invoice_balance (ra.customer_trx_id,
                                                 '08-Sep-2011') <> 0
                   AND sa.salesrep_id(+) = ra.primary_salesrep_id
                   AND sa.org_id(+) <> -3113
                      and ra.purchase_order='2011-0526'
              GROUP BY rac.customer_number,
                       rac.customer_name,
                       su.LOCATION,
                            ra.invoice_currency_code ,
                     ra.trx_number,
                           RA.PURCHASE_ORDER,
                       rad.gl_date,
                       ra.purchase_order_date,
                       ra.invoice_currency_code,
                       SUBSTR (sa.NAME, 1, 2)
    
    with the following output
    
    
    CUSTOMER_NUMBER     CUSTOMER_NAME     CONTRACT     BU     SUB_DATE     CCY     PURCHASE_ORDER     TRX_NUMBER     GL_DATE     BALANCE_DUE
    1002     Joint Operations (KGOC / SAC)     JO/SA88/WO06     12     05/29/2011     KWD     2011-0526     2011-0526-M     05/23/2011     4,773.60
    1002     Joint Operations (KGOC / SAC)     JO/SA88/WO06     12     05/29/2011     KWD     2011-0526     2011-0526-S     05/23/2011     3,559.78
    i require the following output
    CUSTOMER_NUMBER     CUSTOMER_NAME     CONTRACT     BU     SUB_DATE     CCY     PURCHASE_ORDER     TRX_NUMBER     GL_DATE     BALANCE_DUE
    1002     Joint Operations (KGOC / SAC)     JO/SA88/WO06     12     05/29/2011     KWD     2011-0526     2011-0526-M     05/23/2011     8333.38
    1002     Joint Operations (KGOC / SAC)     JO/SA88/WO06     12     05/29/2011     KWD     2011-0526     2011-0526-S     05/23/2011     8333.38
    
    ie balance due is sum of the balances  of trx numbers 2011-0526-M and 2011-0526-S(4733.60+ 3559.78)
    Inorder to get this output I have to avoid the group clause trx number and then only to get the sum of the 8333.38, but I need trx number too in my query.

    Can this be achieved

    kindly help

    thanking in advance

    Something like:

    SELECT   rac.customer_number, rac.customer_name,
                       su.LOCATION contract, SUBSTR (sa.NAME, 1, 2) bu,
                       ra.purchase_order_date sub_date,
                       ra.invoice_currency_code ccy,RA.PURCHASE_ORDER,ra.trx_number,
                       TRUNC (rad.gl_date) gl_date,
                       SUM(
                           SUM(npar_get_invoice_balance(
                                                        ra.customer_trx_id,
                                                        '08-Sep-2011'
                                                       )
                              )
                           OVER(
                                PARTITION BY rac.customer_number,
                                             rac.customer_name,
                                             su.LOCATION,
                                             ra.invoice_currency_code ,
                                             RA.PURCHASE_ORDER,
                                             TRUNC (rad.gl_date),
                                             ra.purchase_order_date,
                                             ra.invoice_currency_code,
                                             SUBSTR (sa.NAME, 1, 2)
                               )
                          ) balance_due
                  FROM ra_customer_trx_all ra,
                       ra_site_uses_all su,
                       ra_cust_trx_line_gl_dist_all rad,
                       ra_customers rac,
                       ra_cust_trx_types_all ty,
                       ra_salesreps_all sa
                 WHERE TRUNC (rad.gl_date) <= '08-Sep-2011'
                   AND ra.bill_to_customer_id = rac.customer_id
                   AND su.site_use_code = 'BILL_TO'
                   AND su.site_use_id = ra.bill_to_site_use_id
                   AND ty.cust_trx_type_id = ra.cust_trx_type_id
                   AND ty.TYPE = 'INV'
                   AND ty.org_id <> -3113
                   AND rad.customer_trx_id = ra.customer_trx_id
                   AND rad.account_class = 'REC'
                   AND rad.latest_rec_flag = 'Y'
                   AND npar_get_invoice_balance (ra.customer_trx_id,
                                                 '08-Sep-2011')  0
                   AND sa.salesrep_id(+) = ra.primary_salesrep_id
                   AND sa.org_id(+)  -3113
                      and ra.purchase_order='2011-0526'
              GROUP BY rac.customer_number,
                       rac.customer_name,
                       su.LOCATION,
                       ra.invoice_currency_code ,
                       ra.trx_number,
                       RA.PURCHASE_ORDER,
                       rad.gl_date,
                       ra.purchase_order_date,
                       ra.invoice_currency_code,
                       SUBSTR (sa.NAME, 1, 2)
    /
    

    SY.

  • How to get the Application Build Date and time?

    Hi guys,.

    I am developing application in Cascade.

    What is the API I can use to get the construction Date of the application and Tiime?

    These macros are expanded to C-strings at compile time. This is how/where to use it. Following an example would work I think:

    fprintf (stderr, "construction date is %s, construction time is %s\n", __DATE__, __TIME__);

  • How to get the FXML controller at run time

    Hello
    is there a way to get the reference of a controller of fxml running?
    I know you can get fxml controller in this way:

    Location of the URL = getClass () .getResource ("MyComponent.fxml");

    FXMLLoader fxmlLoader = new FXMLLoader();
    fxmlLoader.setLocation (rental);
    fxmlLoader.setBuilderFactory (new JavaFXBuilderFactory());

    Parent fxmlNode = fxmlLoader.load (location.openStream ()) (Parent);

    MyController controller = fxmlLoader.getController () (MyController);

    fxmlNode.setUserData (controller);

    and get in fxmlNode.getUserData (), but this is not always possible, for example in the case of inclusion
    (< fx: include source = "OtherConponent.fxml" / >).


    Thanks in advance

    Andrea

    Hello Andrea,

    If you use FXML 2.2 you can do this:

    
    
       
         
      
    
    
    public class FirstController {
        @FXML // included component  fx:id="includedComponent1"
        private Node includedComponent1;
    
        @FXML // controller for included component fx:id="includedComponent1" will be
                   // injected by FXMLLoader if it finds a variable whose name is composed of the
                   // include element fx:id followed by "Controller" => in our case that's
                   // "includedComponent1Controller"
        private IncludedController includedComponent1Controller;
    }
    

    The controller of the included file will be available as a variable inside the controller of the file to include.

    Hope this helps,

    -daniel

  • How can I get the sum of my variables and display the total?

    I wrote on a quiz and have each button by setting a variable, example: http://www.kreativitydesigns.com/Clients/Globus/Monograms/MBA_Test/deliverables/MBA_Quiz.h tml? mode = preview

    However, when it hits the frame of "Rank" to calculate and display the total, it does not appear.

    I do not have the text box named "Grade" on stage and variables have all received a value before entering this framework

    Here is the code used to calcualte and output the result:

    get the value of a variable and store

    var FinalScoreHolder is q1 + q2 + q3 + q4 + q5 + q6 + q7 + q8 + q9 + q10 + q11 + q12 + q13 + q14 + q15 + q16 + q17 + q18 + q19 + q20 + q21 + q22 + q23 + q24 + q25 + q26 + q27 + q28 + q29 + q30 + q31 + q32 + q33 + q34 + q35 + q36 + q37 + q38 + q40 + q39;.

    View rank

    SYM. $("Grade") .html ("you scored" + FinalScoreHolder + "%");

    See the result Page

    If (FinalScoreHolder > = 89) {}

    read the chronology of the given position (ms or label)

    SYM. Play ("Pass");

    } else {}

    read the chronology of the given position (ms or label)

    SYM. Play ("fail");

    }

    Any help would be greatly appreciated.

    Thank you!

    Your code is fine, but it seems that he can not do the values of your questions because if you put the values as below I get the expected result.

    Q1 = 20;

    Q2 = 63;

    Q3 = 12;

    get the value of a variable and store

    var FinalScoreHolder = q1 + q2 + q3;

    View rank

    SYM. $("grade") .html ("you scored" + FinalScoreHolder + "%");

    See the result Page

    If (FinalScoreHolder > = 89) {}

    read the chronology of the given position (ms or label)

    SYM. Play ("Pass");

    } else {}

    read the chronology of the given position (ms or label)

    SYM. Play ("fail");

    }

  • In Windows Media Player 11 when spend to add songs, how get the list to stop starting at the top?

    With WMP11, when adding pieces of the current reading library, I often change between two tabs. My question is every time I switch back to the library to add more songs, tab how can I get the list to stop starting at the top? I have a number of songs scrolling on there where I left last can be very inconvenient. I remember with an older version when you leave the library, that he would stay where you left it. Yet once, how can I stop the library always start at the top and instead pick up where I left off?

    Thank you very much

    Reinstalling wmp11

Maybe you are looking for