Problem by placing the sum

I have below result joinin three tables called TEST table
I placed the cursor selection below
ID     Grp     loc     type     Sum_Lower_1     sum_upper_1     Sum_qty_3
101     abc     x     1     50     200     0
101     abc     x     3     0     0     80
102     abc     x     1     100     400     0
102     abc     x     3     0     0     450
103     abc     x     1     500     2000     0
103     abc     x     3     0     0     230
104     abc     x     1     30     120     0
104     abc     x     3     0     0     50
the result should find id, grp, loc for the followin condn. and we do the deletion of another table for these values

If sum_qty_3 < sum_lower_1 for particular id, grp, loc

If we take 101, abc, x 80 then < 50, so it fails

sum_qty_3 > sum_lower_1 for particular id, grp, loc

If we take 101, abc, x 50 then > 250, so it fails

So, the line does not refer to this id, GRP, loc

Finally, we should have the results below
ID     Grp     loc
102     abc     x
103     abc     x
If sum_qty_3 < sum_lower_1
 delete from product where id = 103 and grp = 'abc' and loc = 'x' and f_type = 2000 
If sum_qty_3 > sum_lower_1
 delete from product where id = 102 and grp = 'abc' and loc = 'x' and f_type = 1000  
How can I achieve this by using the slider or any other way

Please help me

Thanks in adv

Published by: user12093849 on November 27, 2009 03:56

Published by: user12093849 on November 27, 2009 04:08

Is that what you are looking for?

select * from test;
O/P
ID     GRP     LOC     TYPE     SUM_LOWER_1     SUM_UPPER_U     SUM_QTY_3
101     abc     x     1     50                                 200         0
101     abc     x     3     0                                     0       80
102     abc     x     1     100                                  400        0
102     abc     x     3     0                                      0     450
103     abc     x     1     500                                 2000     0
103     abc     x     3     0                                       0     230
104     abc     x     1     30                                    120     0
104     abc     x     3     0                                        0     50

SELECT * FROM(
SELECT id, grp, loc, sum(Sum_Lower_1 )sum_l,SUM(Sum_Upper_u) sum_u,SUM(sum_qty_3) qty_3 FROM Test
GROUP BY id,grp,loc)
WHERE sum_l  qty_3 /* you may have to change the greater than condition, i am confused by your data and the o/p you expect
in the original post */

O/P

ID     GRP     LOC     SUM_L     SUM_U     QTY_3
101     abc     x     50     200     80
104     abc     x     30     120     50

See you soon!
Bobin

Tags: Database

Similar Questions

  • Problem by placing the button in the action bar

    Hey

    I would like to add a button to the toolbar action and a few other actions menu antion. But the problem is that the button also appears in the action menu.

    Here is the code:

    actions:]
    {ActionItem}

    Title: "Option 1".

    onTriggered: {}
    page 1 of var = catalogue1.createObject ();
    Navigational.push (page 1);
    }
    },
    {ActionItem}
    Title: 'Option 2 '.

    onTriggered: {}
    page 2 var = history.createObject ();
    Navigational.push (page 2);
    }
    },
         
    ActionItem
    {
    Title: 'button '.
    ActionBar.placement: ActionBarPlacement.OnBar
                    
    onTriggered:
    {
    work here.
    }
                    
    }
    ]

    The button appeared on the action bar, as well as in the action menu.

    Can someone help me?

    This is 'normal' and what users would expect, this is why I would not recommend that you change it.

    Having said that trapping however the signal AnimatingToVisibleFull or VisibleFull in the menu then hide or remove the action would be the way to go if you must.

    http://developer.BlackBerry.com/Cascades/reference/bb__cascades__actionmenuvisualstate.html

    Of course, a by-product of this is that it will disappear from the bar thus (perhaps make your app look a bit unstable).

  • Problem of calculation the sum in the Transient attribute

    Scenario is,

    I have a form master detail. I want to make the sum of the Quantity column of the secondary table. I have visited many blogs for this tutorial.

    I made view accessor in detail in VO. Master then transitional attribute default Value Master VO, I set value Expression such as DetailViewAccessor.sum ("Qty")

    When I run BCJ4 tester. Transient attribute shows all the total instead of the current detail record. in tutorials they showed her work:)

    J Dev Version 11.1.2.4

    I did it. No need to create to display the details of Accessor.of to the master.  I used ViewLink accessor between master and detail as pictured

    then, by default value transient expression attribute, I wrote ShpContractDView.sum("Qty"), Inseated to the create view accessor.

    It is a success and Trail for me Ashish and Timo please tell me the concept behind what I did?

  • problem by placing the tool position line

    Hi, can someone solve this problem.

    I have created the script for the online tool, but it works does not in particular place. I'll explain in detail.

    Ms job

    I / p: America is a country [SL 10].

    Error output: America is a country...   (or)  ................. America is a country (or) America... is a country (rule puts somewere if I correct position)

    Original output should be like this

    Error output: America is a... country

    I need underscore 10 mm instead of [SL 10]

    It should replace [SL 10] and put a 10 mm rule in this position.

    In my script for the rule is created, but the rule is to put some were elsewhere. Please solve this problem. I created the library also for [SL10].

    Here is my script coding

    app.findTextPreferences = null;

    app.changeTextPreferences = null;

    app.findChangeTextOptions.caseSensitive = false;

    app.findChangeTextOptions.includeHiddenLayers = true;

    app.findChangeTextOptions.includeLockedLayersForFind = true;

    app.findChangeTextOptions.includeLockedStoriesForFind = true;

    MyDoc = App.activeDocument;

    app.findTextPreferences.findWhat = "[SL 10] '"

    myFounds = mydoc.findText ();

    var myLib = app.libraries.item (0);

    var myassets = myLib.assets.item ("SL10");

    for (i = 0; i < myFounds.length; i ++)

    {

    myFound = myFounds [i];

    myFound.remove ();

    myAnchorrule = myassets.placeAsset (myFound.insertionPoints [0]) [0];

    myAnchorrule.appliedObjectStyle = mydoc.objectStyles.item ("SL");

    }

    Hi Rajesh2373,

    I changed your JS code. Please check it out.

    mydoc=app.activeDocument;
    var myLib=app.libraries.item(0);
    var myassets1=myLib.assets.item("SL10");
    
    app.findTextPreferences=null;
    app.changeTextPreferences=null;
    app.findChangeTextOptions.caseSensitive=false;
    app.findChangeTextOptions.includeHiddenLayers=true;
    app.findChangeTextOptions.includeLockedLayersForFind=true;
    app.findChangeTextOptions.includeLockedStoriesForFind=true;
    app.findTextPreferences.findWhat="[SL 10]";
    myFounds=mydoc.findText();
    for(i=myFounds.length-1;i>=0; i--)
    {
        myFound=myFounds[i];
        myAnchorrule=myassets1.placeAsset(myFound.insertionPoints[0])[0];
        myFound.remove();
        }
    
    var myassets2=myLib.assets.item("SL20");
    
    app.findTextPreferences=null;
    app.changeTextPreferences=null;
    app.findChangeTextOptions.caseSensitive=false;
    app.findChangeTextOptions.includeHiddenLayers=true;
    app.findChangeTextOptions.includeLockedLayersForFind=true;
    app.findChangeTextOptions.includeLockedStoriesForFind=true;
    app.findTextPreferences.findWhat="[SL 20]";
    myFounds=mydoc.findText();
    for(i=myFounds.length-1;i>=0; i--)
    {
        myFound=myFounds[i];
        myAnchorrule=myassets2.placeAsset(myFound.insertionPoints[0])[0];
        myFound.remove();
        }
    
    var myassets3=myLib.assets.item("SL30");
    
    app.findTextPreferences=null;
    app.changeTextPreferences=null;
    app.findChangeTextOptions.caseSensitive=false;
    app.findChangeTextOptions.includeHiddenLayers=true;
    app.findChangeTextOptions.includeLockedLayersForFind=true;
    app.findChangeTextOptions.includeLockedStoriesForFind=true;
    app.findTextPreferences.findWhat="[SL 30]";
    myFounds=mydoc.findText();
    for(i=myFounds.length-1;i>=0; i--)
    {
        myFound=myFounds[i];
        myAnchorrule=myassets3.placeAsset(myFound.insertionPoints[0])[0];
        myFound.remove();
        }
    

    THX,

    csm_phil

  • problems by placing the cursor on my Web page (please help)

    im not very good at web design and my last year in College, create a Web site.

    Basically I have a jquery slideshow on the homepage of my site. I placed in my HTML but everything seemed moved and I don't know how to move the real cursor with css.

    so far, this is the site: http://anishjoshi.net23.NET/

    anyone would be grateful for tell me why everything happened and how to fix it back. and also move the slide down to adjust the box.

    cheers in advance

    Try this (view source to see the code)

    http://ALT-Web.com/test/2-column-test.html

    The body background color is #222222. It is the repeating background image that I use (mosaic of 100 x 100 px) in 4 major areas.

    Nancy O.

    ALT-Web Design & Publishing

    Web | Graphics | Print | Media specialists

    http://ALT-Web.com/

    http://Twitter.com/ALTWEB

    http://ALT-Web.blogspot.com/


  • Problems by placing the text of the word

    I am placing a MS word doc text in my master pages in InDesign and it imports only the part of the text, the first 8 pages and after a lot of blank pages, I see the little red as well as in the box in the lower right corner of the text box, but no matter how many times I continue the flow to the next column the rest of the text will not appear. The MS doc is in the fonts, I did not, but I thought I could do a search and replace once the text flows in because there are a lot of bold and italic, put in shape that I don't want to lose by copying and pasting from Word into InDesign. Anyone have any idea why this is happening, or what I can do to get around all of the 36 pages of text?

    I often see complete Word of the nonbreaking spaces files, too. It is disabling the break a too large number of nonbreaking space online to send the rest of the doc in excess. It is not rare AT ALL when you crop in ID, especially if the column width is different. A picture of great line that would too.

    In addition to reviewing the file in Word, you can place the cursor to the last point see you text in ID and open the story editor to see what is beyond. If it's not obvious (turn on nonprinting characters that you can see the nonbreaking spaces), choose the first two paragraphs in excess and leave the Dungeon options (can be on all lines solidarity or solidarity than hass all the lines together and have too many lines to fit to a page) or No Break is applied to the first line in excess. Check hyphenation, as well.

  • for the sum

    Hello

    I'm having a problem trying to the sum of 200 items I've read in a loop for, for then to get the average value. the value that I'm reading is a temeperature, but is oscilates and I need to get an average value for the pid controller don't get 'confused' by the waves.

    can someone help me please?

    Try something like that. I can't test it here, because I don't have the equipment.

  • BI publisher won't just the sum

    I have the latest Oracle BI Publisher 11. 1.1.7.0

    Problem is with the sum, it simply does not work by default.

    <? sum (current - group () / ATH_DEBIT)? >

    What can I do?

    http://S29.postimg.org/bbcl2guon/sum.jpg

    Try this, it will work now

    Flow:

    Credit:

    The problem is, fields of debit and credit are null/empty values in a few lines. You should ignore null/empty when you do the math.

  • Calculation of the sum of a column on a XML editor RTF with NULL values

    Hello

    I have a problem to get the sum of a column in XML editor RTF, if one of the lines has a null value.

    say, I have 4 columns and values

    CASES1:
    NULL, NULL, 4, NULL
    Sum, I expect is: 4

    CASE2:
    NULL, NULL, NULL, NULL
    I'm waiting for is a null

    Is there a way to do this?

    Thank you
    Anita

    Try this

    AMT's column

  • Problem with the sum of the elements of cluster

    Hello

    I have a problem (maybe very simple to solve). I have a cluster with 3 integers inside. I'm building a table of these elements (after unbundling my cluster) and I want to make the sum of all these parts. However, my result is not satisfactory. For example: my table: [255,255,238] and LV shows me the sum of the parts: 236.

    Probe 6 on my printscreen: my table

    The probe 7: operating result of the sum

    What I am doing wrong? Thanks in advance

    Your data type seems to be U8, so the maximum value can not 255. (It's a little hard to read because of the image resizing). Why don't attach you the VI instead?

    If you need the actual amount, you must first convert them to a different representation (for example the U16).

    In addition, what is the purpose of the loop FOR? Since it only works for an iteration, you might as well delete.

  • I have problems with the shopify widget in Muse. I have configured my shopify store, but when I placed the button 'buy' is didn't tell the product no availabe longer and does not appear when I'm writing the site.

    I have problems with the shopify widget in Muse. I have configured my shopify store, but when I placed the button 'buy' is didn't tell the product no availabe longer and does not appear when I'm writing the site.

    Please contact the original publisher of the widget.

    Thank you

    Sanjit

  • Beginner problems - how to make the sum of the lists in a drop-down table

    Hello

    Please forgive my newness but I'm creating a table with 10 + lines and columns and need to calculate the sum of the columns. The user must select a number from a drop-down list and I would like to summarize these nbumbers at the bottom of the column, seems simple enough...

    I have named each cell in the links tab but can't seem to find the script of the sum on the right. I just started using livecycle and have had a good experience so far.

    I wish it was like excel where you just need to click or highlight the cells you want to summarize and do with it but I can't seem to find the easy button...

    You can not simply highlight a column, name it and then use that name in a script to sum?

    Thanks a lot for all the help and I have looked around, but can't get a grip on this one, so I apologize if this is requested before.

    Go easy on me.

    You have to be very accurate with referencing the fields or the formulas will not work. If you have renamed the fields of their default values, then you should reference them as you named the.

    Here's an example of my hierarchy, called as you explained:

    In this case, the use of scripts on the Total field will look like this:

    this.rawValue = (Row1.A1.rawValue * 1) + (Row2.B1.rawValue * 1) + (Row3.C1.rawValue * 1) + (Row4.D1.rawValue * 1);

    So that when I switch to preview, it behaves correctly:

  • 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

  • The SUM problem

    Hello

    Table

    Day, number_of_orders
    Monday, 2
    Tuesday, 3
    Monday, 2
    Tuesday, 2
    On Monday two, 7
    Monday 2, 3
    Friday, 1
    ...
    I want to summarize every Monday, Tuesday all the...

    to get the result
    Day, number_of_orders
    Monday, 4
    Tuesday, 5
    On Monday two, 10
    ...

    Please help a newbie.
    Thank you

    Published by: Izzy on July 6, 2010 23:43

    Welcome to the forum.

    Use the SUM and the GROUP OF

    SQL> create table t as
      2  select 'Monday' day, 2 number_of_orders from dual union all
      3  select 'Tuesday', 3 from dual union all
      4  select 'Monday', 2 from dual union all
      5  select 'Tuesday', 2 from dual;
    
    Table created
    SQL> select day
      2  ,      sum(number_of_orders) number_of_orders
      3  from   t
      4  group by day;
    
    DAY     NUMBER_OF_ORDERS
    ------- ----------------
    Monday                 4
    Tuesday                5
    

    Documentation Oracle starts @ http://tahiti.oracle.com

  • SQL query to display the sum of the values of each June and December

    Hello having problems of construction of a query to the list SQL query to display the sum of the values of each June and December each year.

    My Table;

    TABLE name: MONTH_TERM

    Fields with values:

    TERM_KEYMONTH_ACTUALMONTH_DATE
    8250001/11/2015 0:00
    8245001/12/2015 0:00
    8240501/01/2016 0:00
    8240001/02/2016 0:00
    8245001/03/2016 0:00
    8242501/04/2016 0:00
    8243501/05/2016 0:00
    8241006/01/2016 0:00
    8240901/07/2016 0:00
    8241501/08/2016 0:00
    8242009/01/2016 0:00
    8242210/01/2016 0:00
    8243611/01/2016 0:00
    8255601/12/2016 0:00
    8256801/01/2017 0:00
    8262402/01/2017 0:00

    What I would like to see in a query result:

    TERM_KEYMONTH_ACTUALMONTH_DATETotal of 6 months
    8250001/11/2015 0:00
    8245001/12/2015 0:00950
    8240501/01/2016 0:00
    8240001/02/2016 0:00
    8245001/03/2016 0:00
    8242501/04/2016 0:00
    8243501/05/2016 0:00
    8241006/01/2016 0:002525
    8240901/07/2016 0:00
    8241501/08/2016 0:00
    8242009/01/2016 0:00
    8242210/01/2016 0:00
    8243611/01/2016 0:00
    8255601/12/2016 0:002658
    8256801/01/2017 0:00
    8262402/01/2017 0:00

    ---

    Here's my query:

    Select

    "TERM_KEY,"

    "MONTH_ACTUAL,"

    to_char(MONTH_DATE,'MM/YYYY') MONTH_DATE,

    DEAL to_char (MONTH_DATE, 'MM')

    WHEN '06' THEN (SELECT SUM (MONTH_ACTUAL)

    OF MONTH_TERM

    WHERE the to_char (MONTH_DATE, 'MM') between 1 and 6

    AND term_key = 82)

    WHEN '12' THEN (SELECT SUM (MONTH_ACTUAL)

    OF MONTH_TERM

    WHERE the to_char (MONTH_DATE, 'MM') between 7 and 12

    AND term_key = 82)

    ELSE null

    END as SIX_MO_CUMM,

    of MONTH_TERM

    where term_key = 82

    It's my results:

    TERM_KEYMONTH_ACTUALMONTH_DATETotal of 6 months
    8250001/11/15 0:00
    8245001/12/15 0:003608
    8240501/01/16 0:00
    8240001/02/16 0:00
    8245001/03/16 0:00
    8242501/04/16 0:00
    8243501/05/16 0:00
    8241001/06/16 0:003717
    8240901/07/16 0:00
    8241501/08/16 0:00
    8242001/09/16 0:00
    8242210/01/16 0:00
    8243601/11/16 0:00
    8255601/12/16 0:003608
    8256801/01/17 0:00
    8262401/02/17 0:00

    Any ideas on how to fix would be great

    Select term_key,

    month_actual,

    month_date,

    case mod (to_char (month_date, 'mm'), 6)

    When 0 then sum (month_actual)

    During)

    term_key partition

    order of month_date

    between the previous month '5' interval and the current line

    )

    end '6 MONTHS in TOTAL'

    from tbl

    order of term_key,

    month_date

    /

    TERM_KEY MONTH_ACTUAL MONTH_DAT 6 MONTHS TOTAL
    ---------- ------------ --------- --------------
    82 500 NOVEMBER 1ST, 15TH
    82 450 1 DECEMBER 15 950
    82 405 1 JANUARY 16
    82 400 1 FEBRUARY 16
    82 450 1ST MARCH 16
    82 425 1ST APRIL 16
    82 435 1 MAY 16
    82 410 2525 1 JUNE 16
    82 409 1 JULY 16
    82 415 1ST AUGUST 16
    82 420 16 - SEP - 01

    TERM_KEY MONTH_ACTUAL MONTH_DAT 6 MONTHS TOTAL
    ---------- ------------ --------- --------------
    82 422 1 OCTOBER 16
    82-436 NOVEMBER 1, 16
    82 556 2658 1 DECEMBER 16
    82 568 1 JANUARY 17
    82 624 1 FEBRUARY 17

    16 selected lines.

    SQL >

    SY.

Maybe you are looking for