Sum the lesser of two columns when condition is met

Hi. I need help with creating a formula that will sum the lesser value between two columns when a condition in another column is met.
Example: Sum the lesser value between columns B and C when column A contains "x".
...A...B...C
1.....3.....2
2.x...4....1
3
4.x...2....3
A2 and A4 contain "x". The lesser value between B2 and C2 is 1. The lesser value between B4 and C4 is 2. So 1 + 2 = 3. The sum should be 3.

add a new column (let's say columns D) that finds the min of the two columns
=min(B, C)
then use sumif(A, "X", D)
like this:
D1=MIN(B1:C1)
this is shorthand for... select cell D1, then type (or copy and paste from here) the formula:
=MIN(B1:C1)
select cell D1, copy
select column D (by clicking the "D" at the very top of the column), paste
E1=SUMIF(A,"X",D )

Similar Messages

  • How to get the difference between two columns in a column group

    Hi All,
    My first time here and really new to programming. I would like to get the difference between 2 columns that are inside 
    a column group.
    Here is my sample table below: The Column Group is PeriodNumber and can only choose 2. like 1 and 2.. I would like to have a third row which will simply calculate the difference between the amounts in PeriodNumber 1 and 2.
                                PeriodNumber          
    Account                    1                            2     
    1) Cash                10,000                15,000
    2) Receivables      12,000                11,500
    3) Equipment          5,000                  5,500
    Total Assets          27,000                32,000

    Hi yabgestopa,
    From your description, you want to get the difference between two columns in a column group. After testing it in my environment, we can use custom code to achieve your requirement. For more details, you can refer to the following steps:
    Copy the custom code below and paste it to your report. (Right-click report>Report Properties>Code)
    Dim Shared Num1 As Integer
    Dim shared Num2 As Integer
    Public Function GetAmount(Amount as Integer, Type as String)
    If Type = "1" Then
    Num1=Amount
    Else
    Num2=Amount
    End If
    Return Amount
    End Function
    Public Function GetDif()
    Return Num1-Num2
    End function
    Right-click the second column to insert a third column with Outside Group-Right.
    Then use the expressions below in the matrix.
    =Code.GetAmount(Fields!Amount.Value,Fields!PeriodNumber.Value)
    =code.GetAmount(Sum(Fields!Amount.Value),Fields!PeriodNumber.Value)
    =Code.GetDif()
    The report looks like below.
    If you have any questions, please feel free to ask.
    Thanks,
    Katherine Xiong
    Katherine Xiong
    TechNet Community Support

  • Find the difference between two columns in an ssrs matrix ? MSCRM

    Hi All,
    I am working in reporting part of our project (On-line MSCRM 2013) & in reporting services.
    I am trying to create report using fetch xml based. Below is the snap what we required the result.
    Kindly help me, how to get the difference in both column. (Its a matrix table where year is grouped).
    We need difference between both year Like (Plan Revenue of 2013 & Plan Revenue of 2014 difference in Plan Revenue Diff section) and same for Actual
    Revenue.
    https://social.microsoft.com/Forums/en-US/054d5ca4-0d38-4dc6-84a8-88866cc228fe/find-the-difference-between-two-columns-in-an-ssrs-matrix-mscrm?forum=crmdevelopment
    Thanks,
    Mohammad Sharique

    Hi Bro,
    I used parametrized option for year and done the report,Currently we are getting values in Difference column now i want to show
    that value in percentage. How can we show the percentage based on that value. Means i want to show the Difference in Percentage. 
    Kindly help me i tried but getting some issue. Below i am mentioning the code and snap with result.
    Below expression using to showing Plan Revenue in Percentage for year.
    =
    Sum(IIF(Fields!new_year.Value =Parameters!StartYear.Value,cdec(Fields!new_planrevenueValue.Value/1000), cdec(0)))
    - Sum(IIF(Fields!new_year.Value =Parameters!EndYear.Value,cdec(Fields!new_planrevenueValue.Value/1000), cdec(0)))
    /IIF(Sum(IIF(Fields!new_year.Value = Parameters!StartYear.Value,cdec(Fields!new_planrevenueValue.Value/1000), cdec(0)))>0,
    (Sum(IIF(Fields!new_year.Value = Parameters!StartYear.Value,cdec(Fields!new_planrevenueValue.Value/1000), cdec(0))))
    ,1)
    )*100))
    Result issue is as below in snap with highlighted in red colour.
    Kindly help me on this issue also :)

  • From two given tables, how do you fetch the values from two columns using values from one column(get values from col.A if col.A is not null and get values from col.B if col.A is null)?

    From two given tables, how do you fetch the values from two columns using values from one column(get values from col.A if col.A is not null and get values from col.B if col.A is null)?

    Hi,
    Use NVL or COALESCE:
    NVL (col_a, col_b)
    Returns col_a if col_a is not NULL; otherwise, it returns col_b.
    Col_a and col_b must have similar (if not identical) datatypes; for example, if col_a is a DATE, then col_b can be another DATE or it can be a TIMESTAMP, but it can't be a VARCHAR2.
    For more about NVL and COALESCE, see the SQL Language manual: http://docs.oracle.com/cd/E11882_01/server.112/e26088/functions119.htm#sthref1310
    I hope this answers your question.
    If not, post a little sample data (CREATE TABLE and INSERT statements, relevant columns only) for all tables involved, and also post the results you want from that data.
    Explain, using specific examples, how you get those results from that data.
    Always say which version of Oracle you're using (e.g., 11.2.0.2.0).
    See the forum FAQ: https://forums.oracle.com/message/9362002

  • I´ve made four Columns with text and an Image over the middle of two columns. How do I put a text u

    I´ve made four Columns with text and an Image over the middle of two columns. How do I put a text under the Image that spans over the Columns?

    Did you mean that?
    or
    Did you mean that?
    Let me know.

  • Concatinating the values of two columns ???

    Hi,
    Can anyone help me out in concatenating the values of two columns ??
    Please ASAP...
    Thanks

    >
    What's wrong with
    select (col X || '-'|| Col y ) as Z from xyz_table;
    test@ora>
    test@ora>
    test@ora> --
    test@ora> with xyz_table as (
      2    select 1 as col from dual)
      3  --
      4  select (col X || '-'|| Col y ) as Z from xyz_table;
    select (col X || '-'|| Col y ) as Z from xyz_table
    ERROR at line 4:
    ORA-00907: missing right parenthesis
    test@ora>
    test@ora>
    test@ora> --
    test@ora> with xyz_table as (
      2    select 1 as x, 2 as y from dual)
      3  --
      4  select (col X || '-'|| Col y ) as Z from xyz_table;
    select (col X || '-'|| Col y ) as Z from xyz_table
    ERROR at line 4:
    ORA-00907: missing right parenthesis
    test@ora>
    test@ora>
    test@ora> -- ==================================================
    test@ora> --
    test@ora> with xyz_table as (
      2    select 1 as col from dual)
      3  --
      4  select (col || '-'|| Col) as Z from xyz_table;
    Z
    1-1
    1 row selected.
    test@ora>
    test@ora>
    test@ora> --
    test@ora> with xyz_table as (
      2    select 1 as x, 2 as y from dual)
      3  --
      4  select (X || '-'|| y ) as Z from xyz_table;
    Z
    1-2
    1 row selected.
    test@ora>
    test@ora>isotope

  • How to find the difference of two columns in deski

    Hi Everyone,
    I have a deski report which is build from a single query. The report contains two tables.
    Table-1:MTK Loc
               MTKnet
    Table-2:WTK Loc
                WTKnet
    Now i need to find the difference of the columns WTKnet and MTKnet.
    These two are report level variables.Their definitins are as  below:
    MTKnet:=Sum((<Fees Collected by Per Collected>) In Body) ForEach <vMTKLocation>
    WTKnet:=Sum((<Fees Collected by Per Collected>) In Body) ForEach <vWTKLocation>
    Where <Fees Collected by Per Collected> is universe variable.
    Please help...
    Thanks in Advance......

    Hi Bol,
    As I understand you are taking MTK_Loc and WTK_Loc together in  the report which have common values under Fees Collected by Per Collected  column.
    Please follow the steps mentioned below:
    1.  Calculate the Variables MTK_Net as
           =Sum(<Fees>) IN <MTK_Loc>
    2.  Calculate the Variables WTK_Net as
           =Sum(<Fees>) IN <WTK_Loc>
    3. You will get the values based on the Locations MTK_Loc and WTK_Loc .
    You are using combination of values for MTK_Loc and WTK_Loc hence you will get the variable values in combination.
    Insert new column right to the WTK_Net and  write the formula name it Variance.
    =<MTK_Net>- <WTK_Net>
    The values look like :
    MTK_Loc      WTK_Loc             MTK_Net                 WTK_Net             Variance
    Chicago           Chicago                16,696,274.43      157,168.26            16,539,106.17
    Chicago           Madison               16,696,274.43       274,396.12            16,421,878.31
    Chicago           Milvaki                 16,696,274.43       16,622,870.97       73,403.46
    Chicago           Pennsylvania        16,696,274.43        4,299.35               16,691,975.08
    Chicago           Waukesha             16,696,274.43        22,067.08             16,674,207.35
    Here you will see values for MTK_Net are repeated because these are based on the MTK_Loc which is same for all rows i.e. Chicago , same is the case with remaining values of MTK_Loc.
    We can not calculate variabnce based on the values like Canada,Pennsylvania for all values as these values come in combination of each other and as these are all connected columns WEBI groups  Measure data based on the Dimension  and variable columns associated with it.
    MTK_Loc   WTK_Loc          MTK_Net         WTK_Net          Variance.
    Chicago        Chicago           16696274.43        157168.26           16539106.17
    However you can compare the values based on the values  as :
    1. Drag and Drop MTK_Loc and MTK_Loc separately on the report.
    2. Drag and Drop WTK_Loc and WTK_Loc separately and put it on the report, Connect it to the columns MTK_Loc and MTK_Loc columns already dragged. Then you can compare the values
    MTK_Loc                MTK_Net                         WTK_LOC                    WTK_Net
    Chicago                    16,696,274.43                 Chicago                       157,168.26
    Madison                   315,705.91                       Madison                      274,396.12
    Manitowoc              362,632.50                        Manitowoc                  359,978.50
    Milvaki                    54,172.84                          Milvaki                       16,622,870.97
    Pennsylvania             2,966.56                           Pennsylvania               4,299.35
    Waukesha                 9,028.03                          Waukesha                      22,067.08
    Here I unchecked the option avoid duplicate row aggregation (select table-> format table) thatu2019s why it is showing all values as a  sum of all MTK_Net and WTK_Net values corresponding to Location values..
    Here we are using MTK_Loc and WTK_Loc separately and not connected because though values seems same but they are used in combination ( Chicago, Pennsylvania)  in 2 separate tables in DB hence we canu2019t synchronize them by liking these 2 location columns using 2 data providers.
    I Hope this is what you want....
    Thanks....
    Pratik

  • How to partition one column of the resultset into two columns

    Step 1
    Row_Num | Col1 | Col2
    1 52 100
    1 52 101
    1 52 102
    1 52 103
    2 52 200
    2 52 201
    2 52 202
    2 52 203
    2 52 204
    2 52 205
    Step 2
    Row_Num, Decode(Row_Num,1,Col1,Null) Col1_1, Decode(Row_Num,2,Col1,Null) Col1_2,Decode(Row_Num,1,Col2,Null) Col2_1, Decode(Row_Num,2,Col2,Null) Col2_2
    Result
    Row_Num | Col1_1 | Col2_1 | Col1_2 | Col2_2
    1 52 100 Null Null
    2 Null Null 52 200
    1 52 101 Null Null
    2 Null Null 52 201
    1 52 102 Null Null
    2 Null Null 52 202
    1 52 103 Null Null
    2 Null Null 52 203
    2 Null Null 52 204
    2 Null Null 52 205
    What i want it is something as below.
    Row_Num | Col1_1 | Col2_1 | Col1_2 | Col2_2
    52 100 52 200
    52 101 52 201
    52 102 52 202
    52 103 52 203
    Null Null 52 204
    Null Null 52 205
    Null Null Null Null
    Null Null Null Null
    Null Null Null Null
    Null Null Null Null
    Which means move nulls to the last in a group
    I don't need Nulls at the end. I have added that just to show all rows.
    I would also like to know whether any analytic functions can be used to bring the desired result.
    please consider the columns as varchar type even though it has numeric values.
    thanks,
    renga
    Edited by: user12367921 on Dec 18, 2009 5:25 PM

    Both Solomon's solution and Frank's one are based on the sequence of the row. Let's delete the (1 52 102) row from the table, the two queryes will behave the following way:
    Solomon
    SQL >with t1 as (
      2              select 1 row_num,52 col1,100 col2 from dual union all
      3              select 1,52,101 from dual union all
      4              select 1,52,103 from dual union all
      5              select 2,52,200 from dual union all
      6              select 2,52,201 from dual union all
      7              select 2,52,202 from dual union all
      8              select 2,52,203 from dual union all
      9              select 2,52,204 from dual union all
    10              select 2,52,205 from dual
    11             ),
    12       t2 as (
    13              select  row_number() over(partition by row_num order by col2)
    14                      dense_rank() over(order by row_num) rnk,
    15                      col1,
    16                      col2
    17                from  t1
    18             )
    19  select  distinct case rnk
    20                     when 1 then col1
    21                     else lag(col1) over(partition by rn order by rnk)
    22                   end col1_a,
    23                   case rnk
    24                     when 1 then col2
    25                     else lag(col2) over(partition by rn order by rnk)
    26                   end col2_a,
    27                   case rnk
    28                     when 2 then col1
    29                     else lead(col1) over(partition by rn order by rnk)
    30                   end col1_b,
    31                   case rnk
    32                     when 2 then col2
    33                     else lead(col2) over(partition by rn order by rnk)
    34                   end col2_b
    35    from  t2
    36    order by col2_a nulls last,
    37             col2_b nulls last
    38  /
        COL1_A     COL2_A     COL1_B     COL2_B
            52        100         52        200
            52        101         52        201
            52        103         52        202
                                  52        203
                                  52        204
                                  52        205
    Frank
    with t1 as (
                select 1 row_num,52 col1,100 col2 from dual union all
                select 1,52,101 from dual union all
                select 1,52,103 from dual union all
                select 2,52,200 from dual union all
                select 2,52,201 from dual union all
                select 2,52,202 from dual union all
                select 2,52,203 from dual union all
                select 2,52,204 from dual union all
                select 2,52,205 from dual
    got_rs AS
    SELECT row_num
    , col1
    , col2
    , ROW_NUMBER () OVER ( PARTITION BY  row_num
                   ORDER BY      col2
           )  AS r_col2
    FROM t1
    SELECT   MIN (DECODE (row_num, 1, col1)) AS col1_1
    ,   MIN (DECODE (row_num, 1, col2)) AS col1_2
    ,   MIN (DECODE (row_num, 2, col1)) AS col2_1
    ,   MIN (DECODE (row_num, 2, col2)) AS col2_2
    FROM   got_rs
    GROUP BY  r_col2
    ORDER BY  r_col2
    OL1_1     COL1_2     COL2_1     COL2_2
       52        100         52        200
       52        101         52        201
       52        103         52        202
                             52        203
                             52        204
                             52        205In both resultsets the code 103 is now associated to the 202. Is it correct?
    My query assumes (and is a strong assumption) that two rows of the source table can be associated only if they have the same last two digits of the col2 column.
    SVIL>with t0 as (
      2              select 1 row_num,52 col1,100 col2 from dual union all
      3              select 1,52,101 from dual union all
      4              select 1,52,103 from dual union all
      5              select 2,52,200 from dual union all
      6              select 2,52,201 from dual union all
      7              select 2,52,202 from dual union all
      8              select 2,52,203 from dual union all
      9              select 2,52,204 from dual union all
    10              select 2,52,205 from dual
    11             ),
    12  t1 as (select * from t0 where row_num=1),
    13  t2 as (select * from t0 where row_num=2)
    14  Select t1.col1 col1_1, t1.col2 col2_1,t2.col1 col1_2, t2.col2 col2_2
    15    from t1 full outer join t2 on t1.col2+100=t2.col2;
        COL1_1     COL2_1     COL1_2     COL2_2
            52        100         52        200
            52        101         52        201
            52        103         52        203
                                  52        205
                                  52        202
                                  52        204The results are quite different.
    I don't know what is the correct approach (or whether both of them are wrong), hope Renga will clarify.
    Max
    [My Italian Oracle Blog|http://oracleitalia.wordpress.com/2009/12/19/totali-parziali-con-group-by-rollup/]

  • In Pages, how can I make one page have one column on part of the page and two columns on part of the page?

    What I am trying to achieve is a page with one column for all the text I write, but I also want to show two tables (one placed beside the other, not underneath the other) so on the part of the page where I am showing these tables, I would like to have two columns. Is this possible? Underneath the tables, there is more text that should be in one column only.

    Use a layout break.

  • Over partition: how to use to return the max of two columns

    For each unique id, I want to select the value of col2 in the record with the most recent date.
    When the rows with the same IDs have the same dates, I want the max value from col2.
    I want one row for each ID, but I'm getting two rows for ID 3333333.
    with data as
    select 1111111 as id, 'a' as col2, to_date('01-JAN-09','dd-mon-yyyy') as the_date from dual union all
    select 2222222 as id, 'b' as col2, to_date('02-JAN-09','dd-mon-yyyy') as the_date from dual union all
    select 2222222 as id, 'c' as col2, to_date('03-JAN-09','dd-mon-yyyy') as the_date from dual union all
    select 2222222 as id, 'd' as col2, to_date('04-JAN-09','dd-mon-yyyy') as the_date from dual union all
    select 3333333 as id, 'e' as col2, to_date('05-JAN-09','dd-mon-yyyy') as the_date from dual union all
    select 3333333 as id, 'f' as col2, to_date('05-JAN-09','dd-mon-yyyy') as the_date from dual
    select id, col2, the_date
    from
    select id, the_date, col2, max(the_date) over (partition by id) as max_the_date, max(col2) over (partition by col2) as max_col2
    from data
    where the_date = max_the_date and col2 = max_col2 order by id
    Expecting this:
    ID     COL2     THE_DATE
    1111111     a     1/1/0009
    2222222     d     1/4/0009
    3333333     f     1/5/0009
    but I'm getting 2 rows for ID 3333333
    Any suggestions?

    TRy this code without subquery
    SELECT   ID, MAX (the_date)KEEP (DENSE_RANK LAST ORDER BY the_date),
             MAX (col2)KEEP (DENSE_RANK LAST ORDER BY the_date)
        FROM DATA
    GROUP BY ID
    ORDER BY ID
    SQL> WITH DATA AS
      2       (SELECT 1111111 AS ID, 'a' AS col2,
      3               TO_DATE ('01-01-2009', 'dd-mm-yyyy') AS the_date
      4          FROM DUAL
      5        UNION ALL
      6        SELECT 2222222 AS ID, 'b' AS col2,
      7               TO_DATE ('02-01-2009', 'dd-mm-yyyy') AS the_date
      8          FROM DUAL
      9        UNION ALL
    10        SELECT 2222222 AS ID, 'c' AS col2,
    11               TO_DATE ('03-01-2009', 'dd-mm-yyyy') AS the_date
    12          FROM DUAL
    13        UNION ALL
    14        SELECT 2222222 AS ID, 'd' AS col2,
    15               TO_DATE ('04-01-2009', 'dd-mm-yyyy') AS the_date
    16          FROM DUAL
    17        UNION ALL
    18        SELECT 3333333 AS ID, 'e' AS col2,
    19               TO_DATE ('05-01-2009', 'dd-mm-yyyy') AS the_date
    20          FROM DUAL
    21        UNION ALL
    22        SELECT 3333333 AS ID, 'f' AS col2,
    23               TO_DATE ('05-01-2009', 'dd-mm-yyyy') AS the_date
    24          FROM DUAL)
    25  SELECT   ID, MAX (the_date)KEEP (DENSE_RANK LAST ORDER BY the_date ),
    26           MAX (col2)KEEP (DENSE_RANK LAST ORDER BY the_date )
    27      FROM DATA
    28      group by id
    29  ORDER BY ID;
            ID MAX(THE_DA M
       1111111 2009-01-01 a
       2222222 2009-01-04 d
       3333333 2009-01-05 f
    SQL> Edited by: Salim Chelabi on 2009-03-05 11:49
    Edited by: Salim Chelabi on 2009-03-05 11:50

  • K-Bits (1) : Interchange the values of two columns

    Hi Everyone
    I wanted to get started a mechanism of knowledge sharing in the way of a series of threads called “K-Bits” (Knowledge Bits).
    In our day to day work, we learn some new things which can be useful for others. However we hardly get a chance to share it with others.
    Here is the opportunity to share your knowledge in the form of “K-Bits”.
    Here we start with the First Tip of this series.
    You might face a situation where you need to interchange the values of 2 columns in an Oracle database table. 
    E.g. there is a table employee having columns EMPID, FIRST_NAME, LAST_NAME and SALARY. By mistake the values of FIRST_NAME and LAST_NAME have been interchanged. Now you need to bring the data in correct state. 
    You can think about following few options: 
    Option-1_ 
    1.     Alter table employee and add a new column TEMP_NAME to it. 
    2.     Update the values of LAST_NAME to TEMP_NAME. 
    3.     Update the LAST_NAME with the values of FIRST_NAME. 
    4.     Update the FIRST_NAME with the values of TEMP_NAME. 
    5.     Drop the column TEMP_NAME. 
    Option-2 (For Oracle version 9i or higher)_ 
    1.     Alter table employee and rename LAST_NAME column to TEMP_NAME. 
    2.     Alter table employee and rename column FIRST_NAME to LAST_NAME. 
    3.     Alter table employee and rename column TEMP_NAME to FIRST_NAME.
    Probably you can go ahead with any other solution as well. However there is one very simple solution. 
    Option-3_ 
    Let do it by example: 
    DROP TABLE EMPLOYEE; 
    CREATE TBALE EMPLOYEE 
       EMPID             NUMBER 
      ,FIRST_NAME        VARCHAR2(30) 
      ,LAST_NAME         VARCHAR2(30) 
      ,SALARY            NUMBER 
    INSERT INTO EMPLOYEE VALUES (1,'Tendulkar','Sachin', 10000); 
    INSERT INTO EMPLOYEE VALUES (1,'Ganguli','Saurabh', 10000); 
    INSERT INTO EMPLOYEE VALUES (1,'Pathan','Irfan', 10000); 
    INSERT INTO EMPLOYEE VALUES (1,'Khan','Jaheer', 10000); 
    INSERT INTO EMPLOYEE VALUES (1,'Agarkar','Ajit', 10000); 
    INSERT INTO EMPLOYEE VALUES (1,'Dravid','Rahul', 10000); 
    SELECT * 
      FROM EMPLOYEE; 
    UPDATE EMPLOYEE 
       SET FIRST_NAME = LAST_NAME 
          ,LAST_NAME  = FIRST_NAME; 
    SELECT * 
      FROM EMPLOYEE;  The update statement above solves the purpose. Is not it simple? But how does it work?? 
    For any DML (Insert, Update or Delete) oracle internally fires the row level triggers. You can read more about triggers at 
    http://download-east.oracle.com/docs/cd/B10501_01/server.920/a96524/c18trigs.htm
    and 
    http://download-east.oracle.com/docs/cd/B10501_01/appdev.920/a96590/adg13trg.htm#431 
    As you know in row level triggers the values of each column is stored in :OLD and :NEW parameters. For the above UPDATE statement oracle stores the old values of FIRAT_NAME and LAST_NAME in :OLD.FIRST_NAME and :OLD.LAST_NAME parameters respectively and then update FIRST_NAME with :OLD.LAST_NAME and LAST_NAME with :OLD.FIRST_NAME. 
    Regards
    Arun Kumar Gupta

    For any DML (Insert, Update or Delete) oracle internally fires the row level triggers.Any pointer to the documentation supporting this ?
    Edited by: Saubhik on Dec 7, 2010 5:58 PM

  • Blank page appears when condition not met.

    Hi,
    As a part of my requirement, I am developing XML report template that has first page as "statement of account" and second page as "remittance advice".
    Since we require 'remittance advice' in fixed position(for scanning barcodes), we need to have it in separate page. Second page content (remittance advice) will be be produced on certain conditions. When condition is not met it results in blank page.
    We have used MS word in-built page break functionality in our template. We have also tried using <?split-by-page-break:?> but this does not work with our condition. It gives no page break and formatting gets messed up.
    We are facing same issue in another reports where we need to display 'Remittance advice' on conditional basis.
    Did anyone experience such problem? Any help or suggestion to remove the blank page would be greatly appreciated. Thanks.
    Regards,
    Pratul

    Using the page break logicyou provided, word treats it as same page header and I'm unable to place different header for second page here. If I break the link to change header different from previous page and try to give different header in second page this gets reflected in first page as well. So, logically there is no section break here which is required to have different header in MS word. Any idea on this?
    Regards,
    Pratul.

  • How to get difference the min of two columns having different conditions ?

    Hello,
    I am trying to write a query which staisfies the following condittion. I have a table emp which has the following colums empno,ename,deptcode,empstat_code,salary.
    The salary of employees depends on the empstat_code.
    For a given deptcode, I have to compare the mimimum of salaries for empstat_code 'A' with the minimum of salaries for empstat_code 'B' and then a get a difference between the two.
    How can I do this, please advise.
    Thanks
    fm

    Something like this perhaps.
    create table my_emp as
    select
    from scott.emp
    alter table my_emp add emp_stat varchar2(1);
    update my_emp set emp_stat= case when mod(rownum, 2) = 0 then 'A' else 'B' end;
    select * from my_emp;
    TUBBY_TUBBZ?select
      2        min(decode(emp_stat, 'A', sal)) as min_A_sal
      3     ,  min(decode(emp_stat, 'B', sal)) as min_B_sal
      4     ,  deptno
      5  from
      6     my_emp
      7  group by
      8     deptno;
             MIN_A_SAL          MIN_B_SAL             DEPTNO
                   950               1250                 30
                  2975                800                 20
                  1300               2450                 10
    3 rows selected.
    Elapsed: 00:00:00.71Keeping in mind that MIN will return NULL if there are no values for a given emp_stat and deptno combination. So you would have to account for that however your business rules tell you to account for it (likely using NVL to 0)

  • How to show a value in column when condition is true?

    Assume I have the following simplified SELECT statement:
    SELECT a, b, ???
    FROM tab;
    In the third column a value of "yes" should appear when the following condition is true:
    tab.c = tab.d
    Otherwise the value should be "no" (or even blank).
    How can I achieve this?
    The solution should be more general for situation if many tabs are involved,....
    Peter

    How can I achieve this?
    The solution should be more general for situation if many tabs are involved,....So do you expect a generalized SQL statement that handles are arbitrary number of tables with arbitrary column names?
    It would be helpful if you provided DDL (CREATE TABLE ...) for tables involved.
    It would be helpful if you provided DML (INSERT INTO ...) for test data.
    It would be helpful if you provided expected/desired results & a detailed explanation how & why the test data gets transformed or organized.

  • Read a file, calculate the momentum of two columns and calc a summation of them

    I have a file which das three columns. The first of them isn't important for this problem. I have to read the second and the thid ones, and then mutiply them (to calculate the momentum), if they are at the same line. After that I need to sum all the results that I calculated.
    How can I do this?

    If all the data in the file are numeric values you can use the Read From Spreedsheet File VI to get the 2-D array of data.  Then use the index array function and index out column 1 and 2.  Then multiple the arrays together, and then there is a Sum array elements VI that should finish it off.
    See the attached image
    Attachments:
    Temp.JPG ‏19 KB

Maybe you are looking for

  • Ejbmodule error while building the external service app using web service

    Hi, I am new to SOA. I have developed an external service application using web service. While buiding the project i am getting the ejb module error which is mentioned below and the remaining five internal projects are getting deployed successfully.

  • Interactive report gives an error only for a specific user

    An interactive report based on a very complicated select gives an error only when a specific user is logged on. The error is: ORA-00932: inconsistent datatypes: expected - got CLOB. For other users logging using this page it works fine. Authenticatio

  • Track sort order

    What does the song order (sometimes) change when I click on the Album column? Most of the time, my songs show up sorted by track number (I have the track # column displayed). However, for a few albums this is totally messed up. For example My copy of

  • How can i upload a dvd+-r on to my imac?

    Im asking for know how to upload a dvd that I have burn on a dvd player

  • Opening queries in BEx Analyzer

    Hi, We have a new SAP BW installation. When we try to open a query from the BEx Browser, it is opened with an Internet Browser instead of BEx Analyzer. The same occurs if we try to open it from the Favorites menu in the administrator workbench. Does