Group By and the issue of the sum

Is someone can you please tell me how I can get the ins_id to the group so that the dollar amounts correctly summarize? My SQL and outside current has set are listed below.

Very well. What is the right formula?
Sum (p.pur_quantity) * t.tic_rate

Would be
Sum(p.pur_quantity * t.tic_rate)

return the same results / fix?

Tags: ColdFusion

Similar Questions

  • How to get the last row and the sum of all columns in a query

    Hello

    is there a way to get the last record for a column and the sum of all the Archives to another column in the same query.

    Best regards

    You must set your needs correctly volunteers to help here...

    Your data are not good enough to bring you a precise solution. Purpose, you do not have a column, which draws a distinction between the first and the last entry.

    The solution becomes easy based on your design.

    I introduced a grouping called 'id' column and a time column called 'time_of_insert' (only this way you can say with confidence that you can differentiate between the first and last (also a foolproof solution) - you can possibly use sequence (instead of date but if you say that you can insert two lines at the same time) ((and then likely sequence would be a better choice to differentiate instead of a timestamp field) etc...)

    With your sample data, something like this can be done to get the desired results.

    -----------------------------------------------------------------------------------------------------------------------

    WITH dataset AS

    (SELECT 1 id, 10 used, 8 remain, systimestamp + 1/24 time_of_insert FROM DUAL

    UNION ALL

    SELECT the 1 id, 1, 7, systimestamp + 2/24 FROM DUAL

    UNION ALL

    SELECT the id 1, 2, 5, systimestamp + 3/24 FROM DUAL

    UNION ALL

    SELECT 1 id, 1, 0, systimestamp + 4/24 FROM DUAL

    UNION ALL

    SELECT 1 id, 0, 0, systimestamp + 5/24 FROM DUAL

    UNION ALL

    SELECT the 1 id, 1, 4, systimestamp + 6/24 FROM DUAL)

    SELECT *.

    (SELECT SUM (used) ON sum_all)

    FIRST_VALUE (stay)

    COURSES (PARTITION BY id ORDER BY time_of_insert DESC)

    last_row

    Of THE dataset)

    WHERE ROWNUM = 1;

    Output:

    ------------------------

    SUM_ALL LAST_ROW

    ------------------------------

    15                  4

    See you soon,.

    Manik.

  • How to get a handle to the window to screen using just group id and the id of the window?

    Hello

    We are trying to develop a video application, and we use ForeignWindowControl to display the video on the screen.

    We have those ForeignWindowControl declared and defined in a QML file that appears as needed.

    Using the CameraAPI, we are able to get local video displayed correctly on the local video ForiegnWindowControl. For this we have just the window group id and the id of the window api camera and it automatically configures the window newly created by the camera to the position API and the size defined in the QML file.

    However, this is isn't the case with the video remotely. Since there is no method/function similar to the createViewFinder of the camera api, we need to create a new window of ourselves that goes under the Group shared by the ForeignWindowControl remotely, using screen_create_window_type and set all the required parameters.

    To view the video, hard-code manually the position and size of the newly created window so that it corresponds to the position and the size of ForeignWindowControl remote in QML file and is displayed correctly.

    My question is how to find the ForeignWindowControl using just the group id and the id of the window? the way in which the cameraAPi done in-house?

    Any help would be appreciated.

    Thank you.

    There are 3 ways to associate a window with a ForeignWindowControl.

    1 tell the ForeignWindowControl to expect a window with a given windowId.  Then after that libscreen allows you to create your window with the same windowId, use screen_join_window_group() to adhere to the same group that uses the FWC.  The FWC should automatically capture this event and associate the window itself.  This is how the camera it.

    2. call the bindToWindow() of the ForeignWindowControl method to associate the FWC a particular windowId/groupId.  Similar to the #1, but doesn't seem more useful if you create the FWC after the window of the screen has been created.

    3. call the setWindowHandle() of the ForeignWindowControl method.  Similar to the #2, but instead of using windowId/groupId, you spend just the actual handle.

    See the FWC docs:

    https://developer.BlackBerry.com/Cascades/reference/bb__cascades__foreignwindowcontrol.html

    If you have created the window, you can use one of the 3 approaches.  If the window has been created in a different process (eg. mm-engine rendering, or photo-service device), then generally #1 is the approach you would use.

    See you soon,.

    Sean

  • The ABS function and the sum at a time

    <? If: sum (ARCH_AMT)! = '0' ? >

    We used above condition in the model to restrict the data to date, but we were faced with a new problem when ARCH_AMT is to have several lines with the same amount but + ve and ve - that is to say 500, -500, is the sum and do not return data given that the sum would be zero.

    We do ABS (ARCH_AMT) before making the sum that the SUM will be thousand and data will be collected.

    Please suggest how can we have ABS and the sum at a time

    I tried

    <? If: sum (ABS (ARCH_AMT))! = '0' ? > and also choose the conditions and it does not work.

    Thanks in advance.

    Kind regards
    Mahi

    Published by: mahi4luck on March 28, 2012 02:33

    store ABS (ARCH_AMT) in a variable and use this variable in a total cumulative

    example:
    Suppose I have a structure xml like this:



    -500


    500





    Total:

  • Problem with the application of additional row of total and the sum of the records

    Hello gurus,

    drop table T;
    create table T (name, symbol, amount) in select
    Select 'Cindy', 'AA', double union all 1050000
    'Michael', 'ML', DOUBLE union all select 150000
    Select 'Bill', 'BL', double union all 1050000
    Select 'Nancy', 'NY', 4000 DUAL Union all
    'Cindy', 'AA', 3000 Union select double all
    'Michael', 'ML', DOUBLE union all select 1050000
    Select 'Bill', 'BL', DOUBLE union all 1200000
    Select 'Cindy', 'AA', DOUBLE union all 1200000
    "Vish", 'VH', 1200000 from DUAL;

    I want to have a result set from each name, symbol and flat and an additional line "Total" at the buttom that the sum of all.

    SELECT NAME, NVL(SYMBOL,'TOTAL') sym
    Of
    (BY SELECTING NAME, SYMBOL, SUM (AMOUNT) IN T GROUP BY NAME, SYMBOL, SUM)
    GROUP BY grouping sets ((NAME, sym), NAME)

    But it does not work... . When I'm wrong...: (kindly help and thanks in advance)

    Like this

    select name, symbol, sum(amount)
      from t
     group by rollup(name, symbol)
    having (grouping_id(name) = 0 and  grouping_id(symbol) = 0)
        or (grouping_id(name) = 1 and  grouping_id(symbol) = 1)
    

    or

    select name, symbol, sum(amount)
      from t
     group by grouping sets((name, symbol),()) 
    

    Published by: Karthick_Arp on June 29, 2012 03:27

  • Format and the sum of the form feature does not

    Acrobat 10.1.8

    My bank deposit form, I have used for months has stopped working!

    The format $ does not work, it adds the numbers - the sum function is also more... I deleted it, started to scratch etc. Is there a problem with the new update for 10.1.8?

    Hi [email protected],

    There is not this known issue with Acrobat 10.1.8

    There must be something in the form itself that should be checked.

    Please contact Acrobat support and share the form to get help.

  • 20 GB difference between space and the sum of all files

    my c: drive displays of 42.5 GB used space. the sum of all folders on the c: is 22 GB. make all the folders and files not hidden. I just deleted a user account. the files could still be in the cache somewhere? recovery partition is less than 1 GB. Thank you!!

    To study disk space, use download and install Treesize (freeware).
    http://www.Jam-software.com/treesize_free/

    Information about Treesize
    http://www.Jam-software.com/treesize_free/

    When you open Treesize scan select in the Menu and you will see a list of drives. Click on C and it will generate a list of files.

    Display names and 6 larger files sizes and the total at the top of the list.

  • 'group', 'link' and 'the NEST' - difference?

    You can group, link and test video clips on the timeline. The 'nest', one is the only one who really seems to do something similar to what I expect. Two groups and link do not seem to do a gosh darn thing!

    Clips of the Group

    Link and unlink audio and video clips

    Nesting sequences

    Premiere Pro CS5 - CS6 reference

    (12 MB .pdf download)

    http://helpx.Adobe.com/PDF/premiere_pro_reference.PDF

  • CS5 does not record the group sizes and the directory structure

    I created a workspace with my specific parameters, but every time I open the default bridge structure of standard directories on the left (Favorites and computer, just those two) and a weird group sizes on the right side as I did not and I'm not leaving when I closed the bridge.

    CS5 on Windows 7.

    Any suggestions as to what this may be?

    You probably have the setting in preferences advanced, the value "launch Bridge on Login" uncheck as in this option, it will only save the changes he close bridge before closing the computer.

  • Answers: Operation and the sum of the Pivot line is wrong

    Hi all

    I created an application in responses that combines two areas using a Union All set operation. My goal is to create a report with the same dimensions and two measures of different areas, next to each other. To split the action again (after the Union all puts them under eachother), I added a flag that indicates if the measure came form field 1 or 2 area. And I put above a label as measured in my PivotTable to the indicator.

    It works fine, but when I want a total of all the rows in the pivot table, he will just not be the sum in the right way. It shows just the first value found as total, rejecting all of the following values.

    Clues?
    Gilles

    In pivot mode, you can change the aggregation type...
    Change rule of the aggregation of measures - more options - default value to sum

    I hope this works...
    Nicolae Ancuta

  • ESXi 5, link group, VLAN and the Management Interface

    Greetings-

    I suspect that the answer to my question is: 'Buy an another NIC Intel' but here goes:

    I have a server ESXi here with 2 Intel GigE NIC, connected to the same switch managed ahead of Cisco.  A (vmnic0) NETWORK card is connected to the VLAN 200 while the second (vmnic1) is connected to the VLAN 300.  Ports on the Cisco are defined to access mode.

    Internally, the server ESXi, vmnic0 is connected to the 'public' vSwitch, while vmnic1 is connected to the "private" vSwitch

    I also updated the ESXi management IP 24 even as private vSwitch.  This is the key, I suspect.

    I tried to combine the two GigE interfaces in a connection unique 2xGigE and trunk two VLAN 200 and 300 through it.  After struggling through the menus on the ESXi console INTERFACE, I managed to get the IP management save and who responded and was able to connect to the server with the vSphere client.  I did it in X'ing the vmnic0 and vmnic1 in the configuration interface, then setting VLAN 300 in the configuration of VLANS.  But I could not the team/bundle correctly in the two vSwitches vmnic interfaces.  I could never attach a vmnic to one of the switches.

    Can I do all this with only 2 GigE interfaces and maintain access to IP management?

    SWITCH CISCO < == trunk w / VLAN 200 300 2xGigE == > SERVER ESXI

    VLAN 200 is a 28 audience

    VLAN 300 is a private 24 (for example: 192.168.100.0/24)

    IP management is 192.168.100.2

    I need to create a third VLAN for the management IP address and move?  If I master, say, VLAN 400 down to the ESXi server, use another block 192.168 for his IP address, I'll be able to take the vmnic0 and vmnic1 and team on the TWO vSwitches?

    Always follow me? ... :-)  If I can clarify this, by all means ask.  I apologize for the sort of random babbling here.  Thank you!

    JAS

    jasonvp wrote:

    Rickard Nobel wrote:

    You can not have your two vmnic (physical NIC ports) connected to two vSwitches and at the same time have a "grouping". You need to delete one of the vSwitches and recreate the vSwitch remaining trade. VLAN will insulate them even different networks.

    Thanks for the pointers; I finally had the opportunity to try this out and it works as expected.  I EF you the 'right answer' but apparently the forum won't let me since you already have an answer of "useful".

    Nice that you got it working! When you perform the actual configuration with vSwitch Hash IP and physical switch LAG config, it might be a little difficult to do things in the correct order to not lose connection to the ESXi host.

    You can select this message if you wish.

  • Drs host group management and the vm

    Hey guys I was reading the website Arnims how to create drs with the command groups can be new-drsgroup which looked really nice that you can do.

    But in powercli 5 allowing the command is no longer there.

    If anyone knows what happened with her or the replacement. Because im a large deployment and we must automate host placed in the correct when host groups that they placed in the correct cluster.

    The link to the Arnims post is http://www.van-lieshout.com/2011/06/drs-rules/

    Best regards, Boris

    New-DrsVmGroup is a function that is planned Arnim hist post in Listing 1.

    An ay to present them to your scripts is to save the code of Arnim in a .ps1, then point source this .ps1 file

    . ./New-DrsVmGroup.ps

    Note the space between the 2 points.

    You will now be able to call a cmdlet New-DrsVmGroup.

    Similar to the new DrsHostGroup (list 2) and new-DRSVMToHostRule (listing 3).

    You can also put all 3 functions in 1 .ps1 file and point source this file.

    Update: I can find no mention of a New-DrsGroup cmdlet in Arnim station

  • Query SQL using Group by and the aggregate function

    Hi all

    I need your help in writing a SQL query to achieve the following objectives.

    Scenario:

    I have a table with 3 columns. There are 3 possible values for col3 - success, failure, and error.
    Now I need a query that can give me the summary figures for distinct values for col3 for each GROUP BY col1 and col2 values. When there is no values for col3, then it should return ZERO count.

    The example data:

    Col1 Col2 Col3

    success of ABC 01
    success of ABC 02
    success of ABC 01
    ABC 01 failure
    ABC 01 error
    ABC 02 failure
    ABC 03 error
    XYZ 07 failure

    Power required:

    C1 c2 s_cnt F_cnt E_cnt (title)
    ABC 01 2 1 1
    ABC 02 1 1 0
    03 0 0 1 ABC
    XYZ 07 0 1 0

    s_cnt = number of success; F_cnt = number of failure; E_cnt = number of errors

    Please note that the exit should have 5 columns col1, col2, group of (col1, col2) count (success), group of (col1, col2) count (failure), group of (col1, col2) count (error)
    and wherever there are n ROWS, then it should return ZERO.

    Thanks in advance.

    Kind regards
    Shiva

    Hi, Shiva,

    Welcome to the forum!

    Here's one way:

    SELECT       col1
    ,       col2
    ,       COUNT ( CASE
                          WHEN  col3 = 'success'
                    THEN  1
                      END
                 )          AS s_cnt
    ,       COUNT ( CASE
                          WHEN  col3 = 'failure'
                    THEN  1
                      END
                 )          AS f_cnt
    ,       COUNT ( CASE
                          WHEN  col3 = 'Error'
                    THEN  1
                      END
                 )          AS e_cnt
    FROM       table_x
    GROUP BY  col1
    ,            col2
    ;
    

    Whenever you have a problem, post a small example data (CREATE TABLE and only relevant columns, INSERT statements). If you do not, then don't expect answers, you can get to test.
    Also post the results desired from these data.

  • Comparison of the results of the performance and the sum of the sum of array elements

    I did a comparison of the performance of "Add table" with 2 other methods (an Add elements and function of ddot BLAS) to see who was the fastest and also to compare their results, given that I was watching a few slight differences.

    Conclusions
    BLAS ddot's quicker (just a little), then add items, then add it in a loop of table

    BLAS ddot and add items table give identical results almost all the time.

    I don't know why add items in a loop manually gives a slightly different result. I understand there are any rounding due to finite precision errors, but why is it different for the 2 other methods?

    This classic of digital computing: the quality of the result depends on the order of operations.

    A simple example is the calculation of a * b / c with a, b, c equal to 25, 200 and 100 respectively. The result should be 50, but if a, b and c are U8, the result depends on the order of operation, as shown in the example below. DBL and data non-entier, the difference is of course that much smaller, but still there are!

    In your case, the difference also stems from the order of operations:

    -in the table add-in, the product of all the elements is calculated first and then the elements of the array are added.

    -in the loop, the addition is performed after each multiplication.

  • Assignment of students to group learning and the creation of the Group of the learner.

    Hi all

    Are there standard ways to create groups of R12.1.3. I tried looking for the standard API Oracle but do not have to find them. Is there another way of backend, we can create a group of learners. I know to create from request, but we need to loose several groups of learners. I wanted to back-end.

    We will also need to assign the number of learners in the Group of the learner. Can you please explain the possible ways to make these assignments.

    All entries are the most expected.

    Thank you
    Abhishek.

    Hi Abhishek,

    You can use "Compulsory registration" If you're working with an online offer. It will automatically register all learners in a learning group.

    Best regards Anders Northeved

Maybe you are looking for

  • Real email from Apple?

    I received a bill from iTunes saying: I bought an album that wasn't me.  I'm suspicious that the e-mail address doesn't look like an address from apple is a phishing email?  He was sent by the sender below - [email protected] I changed my p

  • Bluetooth on Tecra 9100

    Hi allAfter installing sp2, the function key does work more (fn + F8), so I don't know how to turn on Bluetooth. With bt Manager, I can't because a new link I get an error message such as bt is not ready. Does anyone know how to solve this metter, I

  • How can I recover my Skype conversation to my Android phone text messages

    Hello, I deleted by mistake some conversation of text messages important Skype from my Android phone, I really need to get their feedback, suggestions?

  • After upgrade to El Capitan Time Machine does not automatically

    Recently, I upgraded my Macbook Pro and iMac 24 to El Capitan.  Time Machine does not automatically work on the iMac.   I now use the backup to get a backup to run.  MacBook Pro is very well. Thinking that this might be the associated time Capsule, I

  • Fatal Setup error code1327 E invalid drive error

    Hi, I uninstall the printer from my computer, everytime I needed to print a shhet of the document it was printing different 34 of something else I've had enough of him. Now try to install the software I have uninstall it in the first place. It promt