amount of data to decode the values retuening

How to calculate the sum of multiple values back to decode, the following conditions I: =.

sum (decode (v.value, 1, 1, 0)) s of the sum (decode (v.value, 2, 1, 0)) s1,
sum (decode (v.value, 4, 1, 0)) s3

now I want the sum of s, s1, s3..., but applying the sum at the level of the query does not... sum (s, s1, s3) does not work

Help, please

Published by: user12403816 on June 16, 2012 06:46

The easiest way would be to wrap another query around that you have doing the decoding, something like:

select s, s1, s3, s + s1 + s2 total
from (select sum(decode(v.value, 1 , 1 , 0 )) s,
             sum(decode(v.value, 2 , 1 , 0 )) s1,
             sum(decode(v.value, 4 , 1 , 0 )) s3
      from ...
      where ...)

You could also add decodes and the sum which, something like:

select sum(decode(v.value, 1 , 1 , 0 )) s,
       sum(decode(v.value, 2 , 1 , 0 )) s1,
       sum(decode(v.value, 4 , 1 , 0 )) s3,
       sum(decode(v.value, 1 , 1 , 0 ) + decode(v.value, 2 , 1 , 0 ) + decode(v.value, 4 , 1 , 0 ))
from ...
where ...

John

Tags: Database

Similar Questions

  • Decode the values without ETL (Group Dimension values)

    Hello guys, I have a question that is partly triggered by me not wanting to change the default ETLs.

    I have values in a dimension to come as table:

    Area A
    Region B
    Region C
    Region D
    Region E

    However, I'm hoping to re - org the hierarchy as below:

    A new region
    D new region

    Essentially, there is a new org structure where we Group (consolidation) old parts in new and rename values.

    I know it can be done in ETL but y at - it everywhere else where this is possible? Perhaps in the business layer? Is there a place in the business layer where we can decode the values and combine them?

    Regards and thanks in advance for your help,.

    Hello

    You can do to the RPD layer with an instruction box on a column of logic. However I really wouldn't say that because it means that if the group never changes you need to release a new RPD to get change.

    Why not build a task custom ETL that you can set to run after the vanilla who takes just these values, consolidates necessary (perhaps using a lookup table to find the old-> new maps) and then load it the new value in a column of extension on the dimension or the extension of related dimension, i.e. W_ORG_DX. Then, you can simply display this column in the presentation layer for users. Unless the table in question has millions of people off the coast of columns, just let him do this mapping for each row in the table for each ETL.

    I think it would be a very simple task and would mean that you can change the mappings easily through the table if necessary. This also means that you don't need to touch the vanilla ETL mappings and are not changing the values in the columns of vanilla, as you mentioned that you didn't want to do.

    Kind regards

    Matt

  • Concatenate 2 data fields and the values on the same line

    Hello

    I'm pretty new to BI Publisher. I want to concatenate 2 data (product and ProductType) fields. These concatenated values so I want to put them on a single line.
    for example.
    the values should look like

    ProductType1.Product1, ProductType2.Product2, ProductType3.Product3...

    Thank you.

    Check the forum thread
    Re: Display of horizontal lines
    for a similar request.

    If you still face questions send your sample xml and rtf

  • Mark the Date based on the value of the following line... Delivery very Urgent

    Hello guys

    I work as a Business Intelligenece Developer and one of my reports, I have a requirement where I have a Date column and the date should be in ascending order IE 1 - JAN - 09
    2-JAN-09
    1 - FEB - 09

    If the date is not in ascending order, I need to mark the Date

    Here are examples of data

    Flag - Here if the Date is not in the order I have to report it Print N, i.e. If the date is growing Null we ignore and check the
    Next Date sequence Vale line
    10215 P02095
    10220 P02095
    P02095 10500 13 March 01
    P02095 10600
    P02095 30-Sep-10610 04
    P02095 10960
    P02095 N 10990 05 - Sep - 01
    P02095 20015 1 May 02 N
    P02095 20020 23 April 01 N
    P02095 20030 23 April 01 N
    P02095 50000
    P02095 63500
    P02095 64000
    P02095 64100 18 December 06
    P02095 64125
    P02095 64400 16 March 07
    P02095 64500 16 April 07
    P02095 64550 17 April 07
    P02095 70000 23 April 07
    P02095 70100 27 April 07
    P02095 80000 April 30 07
    P02095 81050
    P02095 81100
    P02095 83000
    P02095 84000
    P02095 14-Sep-86000 07
    86050 P02095
    86230 P02095


    Let me know if you have any questions I'll post it, thank you

    You did not post the version of Oracle, so I'll assume that you're at least 10g. Then the MODEL would be the best solution:

    with t as (
               select 'P02095' col1,'10215' seq,null dt from dual union all
               select 'P02095','10220',null from dual union all
               select 'P02095','10500',to_date('13-Mar-01','dd-mon-rr') from dual union all
               select 'P02095','10600',null from dual union all
               select 'P02095','10610',to_date('30-Sep-04','dd-mon-rr') from dual union all
               select 'P02095','10960',null from dual union all
               select 'P02095','10990',to_date('05-Sep-01','dd-mon-rr') from dual union all
               select 'P02095','20015',to_date('01-May-02','dd-mon-rr') from dual union all
               select 'P02095','20020',to_date('23-Apr-01','dd-mon-rr') from dual union all
               select 'P02095','20030',to_date('23-Apr-01','dd-mon-rr') from dual union all
               select 'P02095','63500',null from dual union all
               select 'P02095','64000',null from dual union all
               select 'P02095','64100',to_date('18-Dec-06','dd-mon-rr') from dual union all
               select 'P02095','64125',null from dual union all
               select 'P02095','64400',to_date('16-Mar-07','dd-mon-rr') from dual union all
               select 'P02095','64500',to_date('16-Apr-07','dd-mon-rr') from dual union all
               select 'P02095','64550',to_date('17-Apr-07','dd-mon-rr') from dual union all
               select 'P02095','70000',to_date('23-Apr-07','dd-mon-rr') from dual union all
               select 'P02095','70100',to_date('27-Apr-07','dd-mon-rr') from dual union all
               select 'P02095','80000',to_date('30-Apr-07','dd-mon-rr') from dual union all
               select 'P02095','81050',null from dual union all
               select 'P02095','81100',null from dual union all
               select 'P02095','83000',null from dual union all
               select 'P02095','84000',null from dual union all
               select 'P02095','86000',to_date('14-Sep-07','dd-mon-rr') from dual union all
               select 'P02095','86050',null from dual union all
               select 'P02095','86230',null from dual
              )
    select  col1,
            seq,
            dt,
            indicator
      from  t
      model
      dimension by(col1,row_number() over(partition by col1 order by seq) rn)
      measures(dt,seq,cast(null as varchar2(1)) indicator,min(dt) over(partition by col1) x)
      rules(
            x[any,rn > 1] order by rn = greatest(nvl(dt[cv(),cv()],x[cv(),cv() - 1]),x[cv(),cv() - 1]),
            indicator[any,any] = case when nvl(dt[cv(),cv()],x[cv(),cv()]) != x[cv(),cv()] then 'N' end
           )
    /
    
    COL1   SEQ   DT        I
    ------ ----- --------- -
    P02095 10215
    P02095 10220
    P02095 10500 13-MAR-01
    P02095 10600
    P02095 10610 30-SEP-04
    P02095 10960
    P02095 10990 05-SEP-01 N
    P02095 20015 01-MAY-02 N
    P02095 20020 23-APR-01 N
    P02095 20030 23-APR-01 N
    P02095 63500
    
    COL1   SEQ   DT        I
    ------ ----- --------- -
    P02095 64000
    P02095 64100 18-DEC-06
    P02095 64125
    P02095 64400 16-MAR-07
    P02095 64500 16-APR-07
    P02095 64550 17-APR-07
    P02095 70000 23-APR-07
    P02095 70100 27-APR-07
    P02095 80000 30-APR-07
    P02095 81050
    P02095 81100
    
    COL1   SEQ   DT        I
    ------ ----- --------- -
    P02095 83000
    P02095 84000
    P02095 86000 14-SEP-07
    P02095 86050
    P02095 86230
    
    27 rows selected.
    
    SQL> 
    

    SY.

    Published by: Solomon Yakobson on January 23, 2010 10:31

  • value of the cell in numbers displays the date instead of the value of the formula in currency

    I use the numbers frequently and a worksheet I'm using suddenly systematically will display a date (April 30, 2017) instead of a sum value that was always there. I tried to change the cell back to currency format, all clear and reset deleting the formal line and inserting a new formula in another cell, and the problem persists. Have left and restarted numbers and the entire computer. Don't know how it happened, or how I can fix this problem.

    Can you post a screenshot?

    SG

  • update of rows of data based on the value of the column

    I have a column in a table with summary of quantity and separation is in the other table, sometimes what happens is that data breach will be increased and I want to update like 0 for example.

    {code}

    CREATE TABLE CUT_SUM (CD_PM_CODE VARCHAR2 (12), CD_PS_CODE VARCHAR2 (12), NUMBER OF CD_QTY);

    INSERT INTO CUT_SUM (CD_PM_CODE, CD_PS_CODE, CD_QTY) VALUES ('A', 'A1001', 4)

    cd_qty is a summary of 4 pcs

    -now I work table or temporary table in the case reports with as much, now I want to reduce to that above.

    CREATE TABLE CUT_SEC (SEC_PM_CODE VARCHAR2 (12), SEC_PS_CODE VARCHAR2 (12), NUMBER OF SEC_QTY);

    INSERT INTO CUT_SEC (SEC_PM_CODE, SEC_PS_CODE, SEC_QTY) VALUES ('A', "A1001", 1);

    INSERT INTO CUT_SEC (SEC_PM_CODE, SEC_PS_CODE, SEC_QTY) VALUES ('A', "A1001", 1);

    INSERT INTO CUT_SEC (SEC_PM_CODE, SEC_PS_CODE, SEC_QTY) VALUES ('A', "A1001", 1);

    INSERT INTO CUT_SEC (SEC_PM_CODE, SEC_PS_CODE, SEC_QTY) VALUES ('A', "A1001", 1);

    INSERT INTO CUT_SEC (SEC_PM_CODE, SEC_PS_CODE, SEC_QTY) VALUES ('A', "A1001", 1);

    -the data I want in cut_sec

    SEC_PM_CODE SEC_PS_CODE SEC_QTY

    AN A1001 1

    AN A1001 1

    AN A1001 1

    AN A1001 1

    AN A1001 0

    {/ code}


    Select * from cut_sum

    CD_PM_CODE CD_PS_CODE CD_QTY
    A A1001 4

    Select * from cut_sec

    SEC_PM_CODE SEC_PS_CODE SEC_QTY
    A A1001 1
    A A1001 1
    A A1001 1
    A A1001 1
    A A1001 1
    A A1001 1
    A A1001 1

    Update cut_sec cs

    Set sec_qty = 0

    where rowid in (select rowid rid

    from (select sec_pm_code, sec_ps_code,

    ROW_NUMBER() on rn (partition sec_pm_code, sec_ps_code order of null value)

    of cut_sec

    ) x

    where rn > (select cd_qty

    of cut_sum

    where sec_pm_code = x.sec_pm_code

    and sec_ps_code = x.sec_ps_code

    )

    )

    SEC_PM_CODE SEC_PS_CODE SEC_QTY
    A A1001 1
    A A1001 1
    A A1001 1
    A A1001 0
    A A1001 0
    A A1001 0
    A A1001 1

    Concerning

    Etbin

  • Video metadata date is incorrect: the value and not of creation date sharing

    10 iOS, iPhone 6 +, Windows 10. Photos and videos are shared through iCloud, but NOT stored in iCloud.

    Once synced on my PC, the photos and videos have a truncated name (for example, "016a1f2e11dfcc680e1009cb96346b67678fb2c6bc.jpg"). Of course, this is not acceptable at all to me when I organize them on my NAS: I prefer a significant, sortable name, as "2016-09-16 18-15-20259 (Apple iPhone 6 more) .jpg.

    To do this, I simply read the EXIF information directly from the image, and I rename the image accordingly. No problem for the photos.

    But for videos... I do the same, in the world, but with less information. I can extract only creation date/time from metadata of the videos, not the unit that captured video. Sad, but I have not found anything else, and at least it's automatic.

    Recently, I found that the date in the video file is NOT correct: this is the timecode of SHARING via iCloud, not the timecode CAPTURE. I have therefore some videos with a delta of two weeks between the true creation as well as the "official" date

    I checked this on my phone: date is correct (once the video is no longer in full screen, the date is displayed at the top of the screen, and it is 'the' date I'm looking).

    So, question: How can I get the date of the 'real' creation of all these videos on my PC? It exists: it appears on the iPhone that took the video (a woman) AND mine. Information is 'lost' only on the PC, but I think it's a problem of reading of 'bad' metadata (I use FFMPEG to get currently), or the wrong file for reading (perhaps within an iTunes/database file, but didn't find, not found in the registry or the other).

    Best solution is to find something operate locally, through the command line, to do it in batch mode. A solution of GUI PEUT agree if I can automate with AutoIt (i.e. should not be a native Win32 application, not Java, .NET, GTK, QT and so on, OR must have an export feature). A solution based on the web is not suitable, but can be less boring to review each video one after another to manually check the date.

    Thanks in advance.

    In my opinion, the only way to fix this is with third-party software like this one.

  • data entry page the value "viewmode.

    I have a data entry page that I would like to allow other users to see but not change and data. APEX has a setting "viewmode" for a page or if I need to manipulate each field in the page? APEX 4.2

    ebenwalker wrote:

    Normal data entry Form. I hope to not have to put the code in each article.  Is there a method to make all the elements 'view only' with a block of code?  (pseudo-code;  If the user = clerk and establish all the elements to display only.)

    APEX 4.2 has support for read-only point, area conditions and level of the page. Put yourself in the form a screen to read-only by using a condition appropriate for the page or region level attribute.

  • Removal of a huge amount of data based on the column Amount

    Hello

    We have a table with more 300 million documents. The table is partitioned on the MRKT_CD and Sub partitioned on AGGREGATE_TYPE_CD. There is a column called SLS_AMT in this table.

    To delete all records where the SLS_AMT is null. What would be the best way to do this? There are more than 9 index into this table, and if I use the approach of the ETG, creating index and collect statistics only run for a very long time.

    Please advise.

    Have you had time to sleep in your database or your database is 24/7?  I mean, do yu have of all time what database not live? for example in SUNDAY?

    If there is, you can RUN remove stmt with parallelism in part, part, for example

    for example

    delete

    Since the partition of mytable (p1)

    where SLS_AMT is null.

    delete

    Since the partition of mytable (p2)

    where SLS_AMT is null.

    and etc.

    and I don't think that there will be no problem.

    ----

    Ramin Hashimzade

  • Set the value of the transaction no. next value when the date is same

    Hello

    I use Oracle Apex 4.2.1 and oracle 11 g 2

    My table with three column trncd, trndate, trnno

    My question is when I am inserting 1st transaction on today's date, then trnno the value 1

    and the next time I insert another transaction on the same date value can trnno automatically set to 2

    next transaction same trnno is 3

    and then another date as trnno begins on the 1.

    Any idea?

    Thank you and best regards,

    Leave.

    Hi, go,

    I created the page #5 as a copy of the #3 Page in your application... The process an insert created and it works... need to create update processes... Go, now there is no need to have "Transaction/day number" field on the right.

    Do you want to save its value what we are entering this area. currently my process does not have this value according to your requirement.

    When I 1st insert transaction on today's date and then trnno has 1

    and the next time I insert another transaction on the same date value can trnno automatically set to 2

    next transaction same trnno is 3

    and then another date as trnno begins on the 1.

    According to your requirement, I added the process on page 5. Run the #5 page and try.

    Thank you

    Lacombe

  • Formula to find the value of the channel

    Hi all

    Support: Dat file containing the value of time and acceleration. Now, there are only two Channels.  Channel 1 is time. Channel 2's acceleration.

    Step 1: Create more than two channels. Channel 3 and channel 4

    Step 2: go to the analysis and acceleration channel research where its value is reached xxxxxxxx 1.

    Step 3: where it has reached 1. XXXXXXXX in the process of accelerating from this point in the channel 3 and 4, paste all the values STD. STD values in the attached excel file.

    How can I do this? What is the formula or the script to do this?

    Thanks in advance.

    Hi Rash.patel,

    You didn't yet tell me where to find the Excel file, so I assumed it would be in the same folder as the VBScript script.  I used the DIAdem Excel Import Wizard to create an *.stp file that can be passed as parameter in the ExcelImport() command to load these curves 2 envelopes by program.  I also added a file dialog box, then you can select the *. DAT to deal with file.

    I think that's

    Brad Turpin

    Tiara Product Support Engineer
    National Instruments

  • How much data transfer during the thin VMFS copy to NFS, which does not support thin?

    1. I copy using - VMFS volume thin for a 2003 hosted server NFS volume.  However, there is no indication that the destination in charge it is thin, and the size of the file becomes the size declared.  When I copy the NFS share that does not support thin volume VMFS does, the file becomes thin.

    a. when I copy volume VMFS volume NFS, the amount of data actually traverses the network?

    b. when I copy volume NFS volume VMFS, the amount of data actually traverses the network?

    2. I have two identical servers with the same 5.1 ESXi on them.  When I copy one of them, starts immediately to 0% and charges while the other starts immediately to 10% and progressive count.  I have never seen this on another server.  If anyone has seen anything like this before?

    Thank you!

    IT_Architect wrote:

    I know already that thin size and thick.

    If the sizes are well apart from each other, it would be easy to see how much is transferred.

  • How to get the value of the tree node without reloading the Page. !

    Hello
    I worked with apex 4.2 and I've created trees and as a table to retrieve the date according to the value of the tree node select the code tree something like that

    {
    Select case when connect_by_isleaf = 1 then 0
    When level = 1 then 1
    of another-1
    end the status,
    level,
    'ENAME' as the title,
    NULL as an icon,
    'EMPNO' as value,
    NULL as ToolTip,
    ' f ? p = 36648:34:5234984107903:P40_SELECTED_NODE :'|| EmpNo as link
    "Dept". "" EMP ".
    Start by "MGR" is nothing
    connect prior "EMPNO" = "MGR".
    siblings arrested by 'ENAME '.
    }
    and I put the Page selected node element: P40_SELECTED_NODE. the tree worked well and recover the data in tabular form according to the value of tree node

    My Question:
    1. I want to recover the data without submitting the page where whenever I select the value of the tree make page reload to update the tabular presentation with the new value, there is a way to convey the value of the tree node to point P40_SELECTED_NODE and in the form of refreshment without page reload.

    2-i want when selected in the page tree run process according to the value of the on-set tree node to create dynamic action with (jquery selector: div.tree li > a) but the value of the incorrect node.

    Concerning
    Ahmed;

    Take a look at my sample tree application.
    When you select a node, a details report is updated. That should help you implement for your situation.
    However, one thing to note is the link on each node that you have. Click on a node to redirect to the same page and set the value of P40_SELECTED_NODE. You can keep the element, but the link should go, as it's him "reload" the page whenever you click on a node. Implementation of the action of "onselect" tree and setting the page element to the value of the node that will be in place. Be sure to add the page element in the elements present in the form of tables.
    The reason why your selector didn't return the correct value is that you have a click event bound to the anchor tag in each element of the list. The anchor tag does not hold the real value (usually and id), but holds that the display value. The items list item containing the real value in their attribute "id". Therefore, to get this value you should always inspect the first parent of the clicked anchor tag. (which is another way to solve it, of course)

  • Getting data nested in the datagrid control

    If my xml is in the form of multiple nested 'nodes'?, so how can I do to serilizing them and get back them properly?

    Example, if my xml looks like this:
    < data >
    Value1 < value > < / value >
    value2 < value > < / value >
    value3 < value > < / value >
    < / data >

    then display the value would be easy to do in my Datagrid, I would simply say to use "myHTTPservice.lastResult.data.value" and it would appear in the grid, but if my data are more complex like this:
    < data >
    < title >
    Name1 < name > < / name >
    < / section >
    < title >
    name2 < name > < / name >
    < / section >
    < title >
    < name > name\3 < / name >
    < / section >
    < / data >

    How I theoretically would you serialize the word 'name' in a table my datagrid could use? If I tell the dataprovider is ' myHTTPservice.lastResult.heading.name then I do not get a table, how I mean all the names found in the topic to put in a picture? What do do that manually on the result of my HTTPservice and if so pointers would be good! Thank you!

    I think you can do: lastResult... name to make an XMLList of the nodes (Note 2 points).

    But if your dataProvider is an XMLList of elements , then your dataField = "name" DataGridColumn should work because to retrieve the value of the name of any article is: item.name. Peter Ent
    Senior Product Support Engineer Flex
    http://weblogs.Macromedia.com/pent

  • failure of the value of the node... very easy to 'replace' on an attribute

    Hello

    (Working on DBXML 2.5.13. on Windows Server 2003)

    The next document in a container:

    < xmlns = "carrapateira.info village" >
    < quantity of images = "124" / >
    < / village >

    When you try to replace the value of the attribute 'quantity' with the dbxml shell, using the following commands:

    dbXML > sending ' ' 'carrapateira.info '.
    Link-> carrapateira.info

    dbXML > cquery/village/photos
    1 objects returned for eager expression "/ village/images".

    dbXML > print
    < xmlns = "images carrapateira.info" quantity = "124" / > "

    dbXML > contextQ @quantity
    1 objects returned for the expression '@quantity '.

    dbXML > print
    {amount = "124".

    dbXML > contextQ 'replace the value of the node. with 222 "
    stdin:7: contextQuery failed

    I always get this last message, whatever I try.

    What is fundamentally wrong in my approach? Or is it a problem of shell?

    Thank you
    Koen

    Koen,

    It's your query - you must cite the '222'

    Kind regards
    George

Maybe you are looking for