See the sum of subset question quiz on a blade of results

I want to show the sum of part only of scores question quiz on a blade of results.

I want to still follow and record the scores of questions (acting as a series of tests), but show that the score some of these question marks (final quiz) to the user. I read these steps http://blog.lilybiri.com/intermediate-score-slides but I only need a subset. I'm not getting any summing the scores showing the partition on the slide.

Any suggestions welcome... Michelle

Even if you need only a subset, the workflow is quite similar. I would create a variable used to store the total score for the questions in this subset. After each question to consider, you add the value of the variable cpQuizInfoLastSlidePointsscored of system to the user variable. At the end of these questions (don't forget the last of them), you will have the total score for this subset in this user variable.

Tags: Adobe Captivate

Similar Questions

  • How do rotate on a date and see the sum of the value of another column

    Hello

    I searched through the forum and cannot find a query similar to my question feels so post this new thread.

    First of all, it is probably useful indicating that I am using Oracle 10 g.

    I have a table that is used to store the details of the booking (essentially a booking system) and I would use this data to display the details of the customers stay on one line.

    The table has the following columns:
    BOOKING_ID
    CUSTOMER_ID
    DATE_OF_ARRIVAL
    NUMBER_OF_NIGHTS
    NUMBER_OF_PEOPLE
    Some example records could be:

    BOOKING_ID    CUSTOMER_ID     DATE_OF_ARRIVAL    NUMBER_OF_NIGHTS   NUMBER_OF_PEOPLE
    --------------------------------------------------------------------------------------------
    1                    201      13-JAN-2010        5                   1
    2                    202      13-JAN-2010        3                   2  
    3                    202      13-JAN-2010        4                   1
    4                    203      15-JAN-2010        2                   3
    On this basis I would like to display the output so that I can show a sum of the NUMBER_OF_PEOPLE reserved to per customer per day, as such:
    CUSTOMER_ID     13-JAN   14-JAN   15-JAN   16-JAN   17-JAN   18-JAN   19-JAN 
    -----------------------------------------------------------------------------------------
    201                   1       1        1        1        1        0        0
    202                   3       3        3        1        0        0        0
    203                   0       0        3        3        0        0        0
    I watched analytical functions in the documentation and several books of Oracle that I have, but have so far struggled to find how to make the performance desired. Even using the excellent response to the previous post on the forum, I got Re: how to count the occurrence of a date in a range I was not able to get a feasible request.

    Any help or advice would be much appreciated.

    Kind regards
    Stu

    Published by: macmanxie on January 10, 2011 21:16

    Hello

    macmanxie wrote:
    ... The suggested approach goes only to return a number if the DATE_OF_ARRIVAL corresponds to the date in the CASE statement, however I have the added complexity of wanting to show a count of all the days that the customer is booked, for, by making use of the NUMBER_OF_NIGHTS. I tried to use some of the examples provided on morganslibrary.org, for example:

    sum( CASE WHEN  TRUNC (arrival_date) between '01/13/2011' and TRUNC (arrival_date+no_of_nights) THEN nvl(no_of_people,0) ELSE 0 END) AS jan_13
    

    but this does not produce the desired result.

    You check if arrival_date is between January 13 and arrival_date + no_of_nights (as if the arrival date could all be posterior to the arrival_date + no_of_nights).
    Are not really interested in whether or not January 13 ib between arrival_date and arrival_date + no_of_nights?

    NVL ( SUM ( CASE
                    WHEN  TO_DATE ( '01/13/2011'
                           , 'MM/DD/YYYY'
                         )          BETWEEN  TRUNC (arrival_date)
                             AND       TRUNC (arrival_date) + no_of_nights
                 THEN  no_of_people
             END
           )
        , 0
        )          AS jan_13
    

    Always format your code. It is important to format your code if you are the only who who will ever read but it is even more important if you are posting on a forum like this and ask other people to read.
    Not to compare the DATEs in the strings; explicitly use a conversion function, like TO_DATE, above, where necessary.
    Both
    SUM (NVL (x, 0)) and
    NVL (SUM (x), 0) get the same results, but the latter is more effective. If you have 1000 lines, the first way is calling NVL 1000 times, but the second way is calling only once.

    If your previous thread
    Re: How to count the occurrence of a date in a range
    Gets you the right data, but it has one row for each distinct combination of customer_id and date, then you can switch it to a form that contains a line by the customer and another column for each date.

    If you need help, post CREATE TABLE and INSERT statements for some examples of data and outcomes from these data. The post you are trying better to a request, including a subquery that gets no cross-the raw table dynamic results.
    There will be a fixed number of columns in the output swing? If this is not the case, how do you deal with that? Which of these options in the thread I posted above)
    Re: County report and the sum of the number of rows by multiple columns
    ) is best for your needs? Than others is acceptable?

  • Why can I not see the details of my question, when you click on it in my profile?

    I've created a new issue earlier this week, and apparently I have a question, based on my profile. When you click on the link 'Question' I see a result search failed. Why can I not see my question (to check if an update)?

    Thanks for that - now I see my original question, which remains unanswered (except someone telling me to use another browser!). You are also able to help with this one please?

    (I can send screenshots to illustrate the problem, if it helps...)

    Soon, K

  • Why can I can hear the sound but can't see the image? First Question CC Pro

    Resolved:

    I went from my GTX680 353.62 at 358.87 driver and that fixed it!

  • Display the sum of all salaries of employees @ footer section

    Hi team,

    I use Jdev 11.1.2.3.0 version.

    I have a requirement where I need to see the sum of all the wages of employees in the employee table footer section in the user interface.

    Is there a declarative approach to this question without using any method Java and master-details relationship.

    Let me know if you need additional information on my problem.

    Thanks in advance,

    Check out ADF - Groovy amounting to Total of a column in a Table. Techartifact that should make your use case.

    Timo

  • Change the value of Point of Question Quiz in Captivate 9 sensitive?

    Maybe I'm missing the option, but I don't see the option to change the value of the point of a quiz question more. It used to be in the Quiz properties but I no longer see it. He moved elsewhere?

    Hmmm, I do not see the score, it is a responsive project:

    Have you installed the hotfix: Hot fix. Adobe Captivate 9 questions

  • How to configure the options of oracle community such as, I see the answers to the questions posted by myself in a separate stream of data/place?

    Hello

    Thank you for your initiative on the oracle community.

    I love the community and wants to play an active role.

    However, I see the discussions initiated by me in a separate stream of data/place rather than mix them in all the other debates.

    is it possible to search all discussions posted by me only in one place?

    Is it possible to configure the options so that only the answers to my questions will be displayed in the Inbox?

    It used to work before, however, I subscribed to a few communities and my Inbox is bombarded with all the discussions. I read and try to answer on the other discussions, but it is difficult to keep track of discussion initiated by me?

    Help, please.

    Its there in your profile

    user10163762

  • How can I get quiz scoring slide to reflect the correct number of questions?

    I have a file with a three question quiz and the slide says answer 12 questions. The specified notation represents nonexistent issues.

    Can you check Panel Advanced Interaction (F9)? You probably total some objects in your file.

  • Cp6 - Quiz questions (change the behavior to submit button - quiz numbering)

    Hi all

    This is the first time I built a Uncategorized quiz (I call it an evaluation of knowledge - placed between courses).

    I chose Multiple choice quiz and scored (deselected report answers to the Quiz properties).

    Issues related to the:

    Is there a way to change the Quiz unintuative actions and button controls?

    I want the learner to be able to click on the submit button and move to the next question immediately (like any other rating system I've ever seen)

    The way Captivate: click on submit, display a correct or incorrect and if it is correct, ask to the learner to click on 'Y' or anywhere to continue.

    I have three sets of questions of quiz (for each of the three lessons).

    Is it possible to keep the number of distinct quizzes in each lesson. Currently, there are 4 questions in Lesson 1, 5 in Lesson 2 and 3 in Lesson 3. I want some lesson 1 quiz questions to display 'x 4' NOT 'x 12"'.

    And MOST important...

    Quiz results appears ONLY on the last set of questions. I need a result of quiz for each of the three sets of questions. Is this possible?

    Thank you

    Shawn

    Take a look on:

    http://lilybiri.posterous.com/intermediate-score-slides for your last question

    http://lilybiri.posterous.com/question-question-slides-in-captivate to refine the process in two steps on question slides

    Lilybiri

  • See the question of the link change

    I wanted to try that show edit links will do. When I clicked on view change it links the links posted and I tried one. She appeared in a new window and I changed the properties and closed the window. now, I refreshed the page to see the changes.

    now, I do not see the toolbar for developers down and see below a list of ball at the bottom of the page. And the links on the Page stopped working. How I go back please help?. If I click on Page 2, I have the developer mode, but when I run the page it opens the page but I can't click links or buttons. JavaScript Error shows ' "apex" is undefined f f object expected. " I disconnected and logged in but without success. Don't know how to solve now.

    JavaScript error

    Webpage error details

    User Agent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; Trident/4.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729 .NET CLR 3.0.30729; Media Center PC 6.0; Tablet PC 2.0; InfoPath.3; AskTbORJ/5.15.23.36191;. NET4.0C;. NET4.0E)

    Timestamp: Thu, July 18, 2013 23:42:50 UTC

    Message: "apex" is not defined

    Online: 111

    Char: 1

    Code: 0

    URI: http://xxxxxserver:8888 / pls/apex-dev/f? p = 301:2:2661249094414679:

    Message: Object EXPECTED

    Line: 1

    Char: 1

    Code: 0

    URI: http://xxxxxserver:8888 / pls/apex-dev/f? p = 301:2:2661249094414679:

    Message: Object EXPECTED

    Line: 1

    Char: 1

    Code: 0

    URI: http://xxxxxserver:8888 / pls/apex-dev/f? p = 301:2:2661249094414679:

    Message: "apex" is not defined

    Line: 1

    Char: 1

    Code: 0

    URI: http://xxxxxserver:8888 / pls/apex-dev/f? p = 301:2:2661249094414679:

    Message: "apex" is not defined

    Line: 1

    Char: 1

    Code: 0

    URI: http://xxxxxserver:8888 / pls/apex-dev/f? p = 301:2:2661249094414679:

    resolved after chaning of the image of a directory in the application apex properties

  • Hide and see the question.

    I asked with button I need to show when the status is "draft".

    I created a condition created for the button where Exoression 1 value = Expression 2

    Where expression 1 is P9_X_STATUS

    and expression 2 is the project.

    The button is still hidden.

    Just to let you know that if I place the button under status field, my skin and see the condition works.

    Any idea?

    Robert

    Hi Robert,.

    Replace the last part of your predicate of...: P9_X_STATUS = null for:...: P9_X_STATUS IS NULL

    Martin

    -----
    [http://apex-smb.blogspot.com/]

  • Newbie question - unable to see the port number in OBIEE presentation Services

    Hello

    I installed IIS and then installed 10.1.3.2.2 OBIEE. The installation was successful, and to restart the OC4J was also started successfully. However, when I hover over submission Services on the start menu, I see the url http:/localhost/analytics and when I click on that I can't see the login screen. . I think I should be able to see the url http://localhost:9704 / analytics. How can I solve this problem?

    Thank you
    Yasir

    No here is a simple way... no need to work in EM...

    Go to the properties of Présentation Services menu option Oracle Business Intelligence :

    In the Web Document tab, replace the URL... simple as that...

  • 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

  • Columns of the sum of different record count of joined tables

    I have a problem with a query, please help.

    I have two tables:
    create table rec_a (key_code varchar(20),
                    TOT_AMT varchar(20),
                    INV_AMT varchar(20))
    / 
     
    create table rec_B (key_code varchar(20),
                    INVOICE_AMT varchar(20),
                   PAID_AMT varchar(20))
    / 
     
    insert into REC_A values (123123,  1168182.16, 1168182.16);
    
    insert into REC_B values (123123, 205699.04,205699.04);
    insert into REC_B values (123123,130912.78,130912.78);
    insert into REC_B values (123123, 81622.87,81622.87);
    insert into REC_B values (123123, 438032.43,438032.43);
    insert into REC_B values (123123, 159936.17,159936.17);
    insert into REC_B values (123123, 151978.87,151978.87);
     
    Table 1
    KEY_CODE TOT_AMT INV_AMT
    123123 1168182.16 1168182.16


    Table 2
    KEY_CODE INVOICE_AMT PAID_AMT
    123123 205699,04 205699.04
    123123 130912,78 130912.78
    123123 81622,87 81622.87
    123123 438032,43 438032.43
    123123 159936,17 159936.17
    123123 151978,87 151978.87


    I wrote a query to sum up all the areas (tot_amt, inv_amt, invoice_Amt, paid_amt)
    SELECT B.key_code,sum(A.invoice_amt),sum(a.paid_amt),SUM(b.tot_Amt),SUM(b.inv_amt) FROM rec_a B, rec_b A WHERE A.KEY_CODE=B.KEY_CODE AND B.KEY_CODE in ('123123')
    group by B.key_code
    I got this:

    KEY_CODE SUM (A.INVOICE_AMT) SUM (A.PAID_AMT) SUM (B.TOT_AMT) SUM (B.INV_AMT)
    123123 1168182.16 1168182.16 7009092.96 7009092.96

    But I expected this

    KEY_CODE SUM (A.INVOICE_AMT) SUM (A.PAID_AMT) SUM (B.TOT_AMT) SUM (B.INV_AMT)
    123123 1168182.16 1168182.16 1168182.16 1168182.16


    Can someone help me out here?

    Thank you

    Published by: 1003064 on April 29, 2013 03:19

    Hello

    1003064 wrote:
    I have a problem with a query, please help.

    I have two tables:
    Table 1
    KEY_CODE TOT_AMT INV_AMT
    123123 1168182.16 1168182.16

    Table 2
    KEY_CODE INVOICE_AMT PAID_AMT
    123123 205699,04 205699.04
    123123 130912,78 130912.78...
    123123 81622,87 81622.87
    123123 438032,43 438032.43
    123123 159936,17 159936.17
    123123 151978,87 151978.87

    I wrote a query to sum up all the areas (tot_amt, inv_amt, invoice_Amt, paid_amt)

    SELECT B.key_code, sum (a.invoice_amt), sum (a.paid_amt), SUM (b.tot_Amt), SUM (b.inv_amt) FROM rec_a A, rec_b B WHERE A.KEY_CODE = B.KEY_CODE AND B.KEY_CODE in ('123123')
    B.key_code group

    I got this:
    KEY_CODE SUM (A.INVOICE_AMT) SUM (A.PAID_AMT) SUM (B.TOT_AMT) SUM (B.INV_AMT)
    123123 1168182.16 1168182.16 7009092.96 7009092.96

    But I expected this

    KEY_CODE SUM (A.INVOICE_AMT) SUM (A.PAID_AMT) SUM (B.TOT_AMT) SUM (B.INV_AMT)
    123123 1168182.16 1168182.16 1168182.16 1168182.16

    Thus, the last 2 columns must be exactly what is stored in table1? Then either
    b include these columns in the GROUP BY clause and not to use the SUM,
    (b) the GROUP BY on rec_a alone, separately, can't join the results to the rec_b, or
    (c) using MIN or MAX, instead of SUM. (Anyone. Since there is only one value, MIN will be the same as MAX.)

    Here is an example of (a):

    SELECT    B.key_code
    ,       sum (a.invoice_amt)     AS sum_invlice_amt
    ,       sum (a.paid_amt),     AS sum_paid_amt
    ,       b.tot_Amt
    ,       b.inv_amt
    FROM        rec_a          A
    ,        rec_b          B
    WHERE        A.KEY_CODE     = B.KEY_CODE
    AND        B.KEY_CODE      in ('123123')
    group by  B.key_code
    ,            b,tot_amt
    ,       b.inv_amt
    ;
    

    I hope that answers your question.
    If not, post a small example of data (CREATE TABLE and only relevant columns, INSERT statements) for all of the tables involved and the results desired from these data.
    Point where the above query is to produce erroneous results, and explain, using specific examples, how you get the right results from data provided in these places.
    Always say what version of Oracle you are using (for example, 11.2.0.2.0).
    See the FAQ forum {message identifier: = 9360002}

  • What type of input parameter is used according to the SUM?

    Hello world
    As we know sum is an oracle function preset. But what these guys here oracle used for input parameters. How did they do that?
    I mean, we can write this sum fuction as many ways as as mentioned below. Please give me some ideas how to do this.
    SELECT SUM(salary) as "Total Salary" FROM employees;
    
    SELECT SUM(DISTINCT salary) as "Total Salary" FROM employees;
    
    SELECT SUM(income - expenses) as "Net Income" FROM gl_transactions;
    
    SELECT SUM(sales * 0.10) as "Commission" FROM order_details;
    Kind regards
    BS2012

    BS2012 wrote:
    Hello world
    As we know sum is an oracle function preset. But what these guys here oracle used for input parameters. How did they do that?
    I mean, we can write this sum fuction as many ways as as mentioned below. Please give me some ideas how to do this.

    SELECT SUM(salary) as "Total Salary" FROM employees;
    
    SELECT SUM(DISTINCT salary) as "Total Salary" FROM employees;
    
    SELECT SUM(income - expenses) as "Net Income" FROM gl_transactions;
    
    SELECT SUM(sales * 0.10) as "Commission" FROM order_details;
    

    Kind regards
    BS2012

    As others have said, your question is not very clear.

    There are many aspects and angles to look at what you're asking.

    First of all, a level superior, the sum function simply takes a numeric value as it's argument, so all of these examples you gave have expressions that evaluate to a numeric value to be provided to the sum function. (As someone else already mentioned you can have non-numeric data types, just as long as they can be implicitly converted to a numeric value).

    A statement analysis and the point of view of enforcement, the content of the expression inside the brackets is evaluated before being passed to the sum function. It is not the function sum that he himself takes the expression and evaluates it. The sum function is expecting just a single numeric value.

    Internally, what the function sum is the case, is more than just a single... call function and return a value, because it faces several values being passed in the aggregation group. As such, it must have the ability to know if to start in short, is to accept several input values, so he can add them together, you know give up adding entries and pass the result to the back.

    If we write our own defined aggregate function (others have already provided a link to explain this) we can see what is happening internally. In the following example, we'll write a function defined by the user that multiplies the values rather than the amounts...

    create or replace type mul_type as object(
      val number,
      static function ODCIAggregateInitialize(sctx in out mul_type) return number,
      member function ODCIAggregateIterate(self in out mul_type, value in number) return number,
      member function ODCIAggregateTerminate(self in mul_type, returnvalue out number, flags in number) return number,
      member function ODCIAggregateMerge(self in out mul_type, ctx2 in mul_type) return number
      );
    /
    create or replace type body mul_type is
      static function ODCIAggregateInitialize(sctx in out mul_type) return number is
      begin
        sctx := mul_type(null);
        return ODCIConst.Success;
      end;
      member function ODCIAggregateIterate(self in out mul_type, value in number) return number is
      begin
        self.val := nvl(self.val,1) * value;
        return ODCIConst.Success;
      end;
      member function ODCIAggregateTerminate(self in mul_type, returnvalue out number, flags in number) return number is
      begin
        returnValue := self.val;
        return ODCIConst.Success;
      end;
      member function ODCIAggregateMerge(self in out mul_type, ctx2 in mul_type) return number is
      begin
        self.val := self.val * ctx2.val;
        return ODCIConst.Success;
      end;
    end;
    /
    create or replace function mul(input number) return number deterministic parallel_enable aggregate using mul_type;
    /
    

    For example, our user-defined aggregate function is based on a total object type.
    This object keeps a value ("val" in our example).
    It has an Initialize method, so when the SQL engine indicates that this is the beginning of an aggregation of values it can set its value to an initial value (in this case zero).
    It has an Iterate method, the SQL engine passes the values to it in the context of all grouped values, it can treat them (in our case it multiplies the value of entry with the value already there for this game of aggregations (and takes a value of 1 for the first iteration basis))
    She has a Terminate method, so when the SQL engine indicates that the global set of values is completed, it can return the result.
    The last method there is a merger and is mandatory, so that when the aggregation is done parallel assessment tool (for better performance internally), the results of these parallel executed aggregations can be combined (see http://docs.oracle.com/cd/E11882_01/appdev.112/e10765/ext_agg_ref.htm#ADDCI5132). As we are multiplying numbers, in our case, it is simply a case of the multiplication of one single result with each other.

    And to see that it works...

    SQL> with t as (select 2 as x from dual union all
      2             select 3 from dual union all
      3             select 4 from dual union all
      4             select 5 from dual)
      5  --
      6  select mul(x)
      7  from t;
    
        MUL(X)
    ----------
           120
    

Maybe you are looking for