Show Field Values if other Field Value Different

Hey,
I am using TOAD for Oracle 10.5. There is a select statement that is not populating requested results.
Data:
JOB                    SAL
PRESIDENT             5000
MANAGER               2850
MANAGER               2450
MANAGER               2975
ANALYST               3000
ANALYST               3000
CLERK                 800
CLERK                 1100
CLERK                 950
CLERK                 1300
SALESMAN             1600
SALESMAN             1250
SALESMAN             1250
SALESMAN             1500Select Statement
SELECT JOB, SAL
   FROM  EMP
   WHERE JOB IN (
               SELECT JOB
                FROM EMP
                GROUP BY JOB
                HAVING COUNT(*) > 1)
                ORDER BY JOB;Once select statement executed only JOB = PRESIDENT record is removed, not results needed.
JOB                    SAL
MANAGER               2850
MANAGER               2450
MANAGER               2975
ANALYST               3000
ANALYST               3000
CLERK                 800
CLERK                 1100
CLERK                 950
CLERK                 1300
SALESMAN             1600
SALESMAN             1250
SALESMAN             1250
SALESMAN             1500Correct Data, JOB values PRESIDENT and ANALYST records should not appear.
PRESIDENT does not appear but the ANALYST value shows because the statement
is producing duplicate JOB values. I would like to show records only if the JOB values have
different SAL values, not duplicate JOB values. Only if the SAL value is different based on JOB.
JOB                    SAL
MANAGER               2850
MANAGER               2450
MANAGER               2975
CLERK                 800
CLERK                 1100
CLERK                 950
CLERK                 1300
SALESMAN             1600
SALESMAN             1250
SALESMAN             1250
SALESMAN             1500I hope someone can help me out on this one.

Hi,
COUNT (*) tells how many rows are in a group. It has nothing to do with any values in any columns.
I think you want COUNT (DISTINCT sal) in this case. It will tell you how many different values of sal are in the group.
SELECT JOB, SAL
   FROM  EMP
   WHERE JOB IN (
                SELECT JOB
                FROM EMP
                GROUP BY JOB
                HAVING COUNT (DISTINCT sal) > 1          -- Changed
   ORDER BY JOB;Edited by: Frank Kulash on Dec 9, 2010 10:34 AM
Added example.

Similar Messages

  • Move values of one field symbol to other field symbol of different structur

    Hi all,
    i need to move values of one field symbol to other field symbol of different structure.
    I need to perform operations like MOVE-CORRESPONDING on two field symbols of different structure.
    How can i achieve this?
    field symbol 1 have 2 field and field symbol2 have 4 fields....
    Best Regards,
    Vijay.

    Hi,
    You can use -
    MOVE-CORRESPONDING <struct1> to <struc2>.
    In this case it will move the contents of the components from struct1 to struct2 that has identical names.
    You can refer this link also-
    http://help.sap.com/saphelp_nw04/helpdata/en/fc/eb3260358411d1829f0000e829fbfe/content.htm
    Regards,
    Sujit

  • PM Notification - Hide fields based on other field's value

    Hello experts,
    I am looking for an user exit which allows me to hide some fields based on other field's value.
    For example, I have field 1 and field 2. When I open my notification, if the value of field 2 is 'aaa', field 1 has to be hidden.
    There should be an user exit but I can't find it...
    Thanks for your help!

    Hi everyone,
    Any thoughts? any help is appreciated...
    Thanks

  • How to diable only one field enabled and other fields disabled for one user group?

    Hi,
    I have a form contains many fields. A group of users can add items using that form.
    As per the user requirement I have created a filtered view and that filtered view can be seen by some other sharepoint user group but as per their further requirement the new sharepoint user group is only allowed to update Remarks field. All other fields
    should be disabled for them.
    In my idea, I have to create multiple forms and in one of it except Remarks field all should be disabled but I am unable to assign multiple forms to a single list.
    Or how to make Remarks field enable to this user group and for other admin user group all fields could be enabled.
    Hope I have expressed my question correctly.
    Any solution would be appreciated.

    There is no Out of the Box way to set permissions on each column, primarily due to the performance impact. The following thread provides some options,
    http://social.technet.microsoft.com/Forums/sharepoint/en-US/c0794232-9bab-4cea-91d8-f311a793a863/how-to-set-column-wise-permission-in-sharepint-list-in-sharepoint-2010?forum=sharepointadminprevious
    Dimitri Ayrapetov (MCSE: SharePoint)

  • F4 help based on the Value in other field

    Hello
    I have a requirement in which there are two fields say field1 and field 2 in an ALV grid (in which  new data can be entered). The F4 help of field 2 should be based on the value  the user enters on field1.I have checked out the BC_ALV* programs but there are no clear help .
    I have tried setting the parameter id of the first field value and then get that parameter id on_f4 event of the second field.But where can i set the parameter id of the first field . on_f4 of first field does not have its value and there is no event after_f4 . There is a parameter e_afterf4 in data change event but to tirgger that there shud be some event right.
    Moreover If at all i get the first field value , i can use FM F4_int_table_value_request to show the refined f4 in field 2 . But I am passing the a field symbol table in my grids set table for first display . what can i pass as parameters here to the FM  F4_int_table_value_request?

    hello Kallu ,
      gt_f4_wa-getbefore  = 'X'. --->refreshing layout before F4
      gt_f4_wa-chngeafter = 'X'--> refreshing layout after f4.
    see the sample code of F4...no need to pass dynpro details.....
    *---locals.
      data:  lt_return type table of ddshretval,
             ls_return type ddshretval,
             begin of lt_kostl occurs 0,
              kokrs type kokrs,
              datbi type datbi,
              bukrs type bukrs,
              prctr type prctr,
             end of lt_kostl,
             ls_f4           type  lvc_s_modi.
      field-symbols: <ls_wa>         type any,
                    <t_f4> type lvc_t_modi.
    *---get defalut values.
      refresh lt_kostl.
      select kokrs
             kostl as prctr
             datbi
             bukrs
        from csks
        into  corresponding fields of table lt_kostl
               where kokrs eq g_kokrs
                 and datbi ge sy-datum
                 and bukrs eq yfit_00049-bukrs.
    *---call fm to display int values.
      call function 'F4IF_INT_TABLE_VALUE_REQUEST'
        exporting
          retfield        = 'YFIT_00050-PRCTR'
          window_title    = 'Profit Center list'
          value_org       = 'S'
          display         = space
        tables
          value_tab       = lt_kostl
          return_tab      = lt_return
        exceptions
          parameter_error = 1
          no_values_found = 2
          others          = 3.
      if sy-subrc <> 0.
        message id sy-msgid type sy-msgty number sy-msgno
                with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
      else.
        read table lt_return into ls_return
                   with key fieldname = 'F0004'.
        if sy-subrc eq 0.
          assign er_event_data->m_data->* to <t_f4>.
          ls_f4-fieldname = e_fieldname.
          ls_f4-row_id    = es_row_no-row_id.
          ls_f4-value     = ls_return-fieldval.
          ls_f4-error     = space.
          ls_f4-tabix     = space.
          ls_f4-style     = space.
          ls_f4-style2    = space.
          ls_f4-style3    = space.
          ls_f4-style4    = space.
          append ls_f4 to <t_f4>.
        endif.
      endif.
      er_event_data->m_event_handled = 'X'.
    regards
    Prabhu

  • Populate f4 values of a field based on value of other field

    Hi,
    I have created select options using WDR_SELECT_OPTIONS.For one of the fields ,f4 values should be based on value of another field in the screen.
    How will i achceive this requirement.
    I got a link about the same but that is not using WDR_SELECT_OPTIONS
    http://www.sdn.sap.com/irj/scn/logon?redirect=/irj/scn/wiki?path=/display/WDABAP/Using%20Search%20help%20attachments%20for%20WebDynpro%20ABAP
    I got another link
    http://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/606288d6-04c6-2c10-b5ae-a240304c88ea?quicklink=index&overridelayout=true
    which I am going to try
    Thanks
    Bala Duvvuri
    Edited by: Bala Duvvuri on Jun 22, 2011 6:49 AM

    Hi,
    Using OVS you can achieve this.,  In OVS Event Handler read the value based on which you  want to display F4 for other field and populate the values based on the first field.
    this link is fine., go through this: http://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/606288d6-04c6-2c10-b5ae-a240304c88ea?quicklink=index&overridelayout=true
    hope this helps u.,
    Thanks & Regards,
    Kiran

  • How to populate value in other field after entering in one field?

    hi everyone.
      when i enter value in one field , automatically some xyz value should be populated  in second field. How would this be possible without any enter? I mean i don want to perform any action like press enter or like that.

    Hello manumb6 ,
    You coud also use "TimedTrigger" UI element for the same and you can specify the "delay" value in seconds.
    Suppose if you enter x value.
    After X seconds it will trigger the particular action associated to UI element.
    My suggestion would be that you generate this UI element Dynamically when you expect end user to enter the value in the input field and system would keep invoking the method and as soon as your objective is met, Delete the UI element .
    Hope this would help.
    Regards
    Anurag Chopra

  • How to set default value in one field depending on other field.

    Hi,
    I have one requirement.That is..One seede page having 2 field, one is Lov Input field and one more message choice filed.
    Requirement is after selecting value in Lov input field need to set one default value in to Message choice field. how to do this one.pls send any sample code for this requirement.
    Thanks in Advance,
    Hanimi...

    Hi,
    I used following code
    OAMessageLovInputBean lovbean=(OAMessageLovInputBean)webBean.findIndexedChildRecursive("AssetNumber");
    OAMessageChoiceBean Choicevalue=(OAMessageChoiceBean)webBean.findIndexedChildRecursive("EamWrPriority");
    if (pageContext.isLovEvent())
    String lovInputSourceId = pageContext.getLovInputSourceId();
    if(lovInputSourceId.equalsIgnoreCase("AssetNumber"))
    if(lovbean!=null)
    String slovVal=(String)lovbean.getValue(pageContext);
    String prValue = getPRValue(pageContext.getApplicationModule(webBean).getOADBTransaction(),slovVal);
    //String prValue = "1";
    Choicevalue.setValue(pageContext,prValue);
    }// end of processFormRequest
    private String getPRValue(OADBTransaction con,String slovVal)
    // System.out.println("In WorkRequestDffCO.getContextValue.organizationID" + organizationID);
    String prValue = null;
    String sql = "select decode(ml.meaning,'AC1',1,'AC2',1,'AC3',3,'AC4',3,null) from FND_LOOKUP_VALUES_VL ml ,mtl_serial_numbers msi where ml.lookup_type = 'MTL_EAM_ASSET_CRITICALITY' and msi.ASSET_CRITICALITY_code = ml.lookup_code and msi.serial_number = 'slovVal' ; //'30AC-TR002B'"
    Statement st = null;
    ResultSet rs = null;
    try
    st = con.createStatement(1);
    rs = st.executeQuery(sql);
    if(rs.next())
    prValue = rs.getString(1);
    catch(Exception e)
    e.printStackTrace();
    finally
    try
    if(st != null)
    st.close();
    if(rs != null)
    rs.close();
    catch(Exception e)
    e.printStackTrace();
    return prValue;
    Query is executing but no value is retuning, if i use hard coded value in where condition like '30AC-TR002B' it is tt's returning value .

  • Get max value with other fields

    Hi All,
    I have a table as below
    Name Value
    A1     5
    A3 10
    A2 7
    A2 9
    A1 10
    What I would like to get is the max(Value) and with grouping of its name
    Name     Value
    A2 16
    Thanks
    Alex
    Edited by: user8606416 on 01-Jun-2011 10:17
    Edited by: user8606416 on 01-Jun-2011 10:26

    Depending on how you feel about ties one of:
    SELECT name, value
    FROM (SELECT name, SUM(value)
          FROM table
          GROUP BY name
          ORDER BY 2 DESC)
    WHERE rownum = 1
    SELECT name, SUM(value)
    FROM table
    GROUP BY name
    HAVING SUM(value) >= ALL (SELECT SUM(value)
                              FROM table
                              GROUP BY name)among many other methods. The first will pick a single arbitrary record in case of a tie, the seond will show all of the tied records.
    John

  • Cannot select fields for calculating other fields~

    Help -- I am tryiing to get certain fiels in a form to calculate based on selection of other fields.  The fields to be selected already have values in them.  (The same format I have used for several years, just new set of forms)
    I get through the point of setting up the field properties to calculate and I select Sum of...   Then it simply will not let me select any fields to use for calculations -- unless I select all fields.
    Please -- this is time sensitive and urgent any help responses needed and welcome!

    Sounds like you are having issues with Acrobat and not FormsCentral. You would get a better help if you post your question on the Acrobat's forum
    http://forums.adobe.com/community/acrobat/forms
    Gen

  • How to display F4 values in one field based on other field selection

    Hi All,
    How to hide a UI element (i.e Link to action) highlited for Normal User and display the same to super user.
    Component Name : /SAPSRM/WDC_DODC_SC_GAF_C
    2.Can i know how to display  the entries in supplier field based on Product category selection.
    Right now all the entries are getting displayed in the supplier field.
    I want to display only entries based on Product category.
    Search Help Name : BBP_BUPA_CLL_PARTNER
    Component Name : /SAPSRM/WDC_DODC_SC_I_LIM
    How to enhance the web dynpro component with the filtered values.
    Regards,
    Krish.

    Hi Ashvin,
                 Thanks for the document. In the search help there is a standard FM which is getting executed.
    Can i enhance that FM or should i copy and edit.
    BBP_F4IF_SHLP_EXIT_CLL_PARTNER
    If i creata a Z FM and make changes how to pass that values to my standard Component View UI Element.
    If not then suggest me some alternative.
    Regards,
    Krish

  • Assigning Values to a Field Depending on Other Field

    Hi,
    I'm creating a survey that is used to capture data on a yearly basis. We are attempting to make the survey as self-validating as possible to minimize workload. One section of the survey asks for a yearly change in the number of people in a program, asking for both the number of people entering the program and the number leaving the program. We need this section to self validate by checking that the number of people in the program at the beginning of the year, plus the number added to it, minus the number leaving it, equals the number of people in the program at the end of the year.
    The validation formula for this is easy. The difficult problem is automatically assigning a value to the beginning of year value. We will know what this value is due to collecting a response from the program the previous year. My plan is for this field to self-fill depending on an earlier response to the selection of the program name.
    Suppose there is a question earlier in the survey asking for the program name, I'll call it ProgramName. This is a drop down list that must be selected from a list. I need the export value of the drop down list to be the program name they selected. My plan is that for the field later in the survey to fill like this:
    switch(ProgramName.value)
         case "Program1":
              currentfield = "1"
         case "Program2":
              currentfield = "2"
         default:
              currentfield = "0"
    Unforunately I am very new to writing JavaScript and don't know the syntext to get this result. Any help would be appreciated!
    Thanks

    What you're proposing is a custom calucalte script for the beginning of year value field that gets set based on the dropdown selection. I'd suggest setting the field value in the validate event of the drop down instead, in which case the code would look like:
    // Set the beginning of year field value based on this field's selection
    // initialize variable
    var begin_num = 0;
    switch (event.value) {
    case "Program1":
        begin_num = "1";
        break;
    case "Program2":
        begin_num = "2";
        break;
    case "Program3":
        begin_num = "3";
        break;
    // Set be beginning number field value
    getField("begin_num").value = begin_num;
    Where "begin_num" is the name of the field that will contain the beginning number.

  • Crosstab - Comparing value with other fields

    Post Author: Micho
    CA Forum: General
    Hi , I'm using CRXI Standard (eclipse plugin) and I have
    some trouble to customize my crosstab.
    Here is a simple example of what I'd like to doStructure of my resultset:ColumnsPARTNUMBERSECTOR_NAMEQUANTITYORDER_LATE_FLAG My crosstab looks like thisRows=partnumbercolumns=sector_namecalculated fields=sum(quantity)                    |    sector_name1   |   sector_name1   |----
    partnumber     |  sum(quantity)   |   sum(quantity)   |                    |                         |                          |  What I need to do is that I want to display a "*" before the total quantity if a partnumber has it's ORDER_LATE_FLG set to true
    if ({ORDERS.ORDER_LATE_FLAG} = "Y") then       "*"+
         ToText(CurrentFieldValue)
    else       ToText(CurrentFieldValue)The problem is that {ORDERS.ORDER_LATE_FLAG} always refer to the first record, and not always to the value of the Current record beeing processed.Is there's a solution to that ?? Thanks
    Phil

    Post Author: V361
    CA Forum: General
    you can try adding
    whileprintingrecords;
    before the formula.

  • How can I make a dropdown box populate with values from other fields?

    I am trying to create a NCAA bracket where they select teams from a dropdown menu. For example, they choose which teams win in game 1 and 2 through a dropdown box. The winner of games 1 and 2 then play each other, so how can I populate the dropbox with their selections for game 1 and 2?
    Game 1 winner --
         (game 9)        |--- Game 9 winner
    Game 2 winner --
    Game 9 winner needs to populate with their selections from game 1 winner and game 2 winner.

    I would look at using the setItems Acrobat JavaScript method.
    Have you considered using  a Mouse Up action for "Game 1" and "Game 2" to fill "Game 9"

  • Help. How to link the value on other spreadsheet with different path

    The data is in the spreadsheet on path: Macintosh HD/Users/fridayge/work/list.xls
    I want to link the value to Numbers sheet.
    If in ecxel, I can express ='Macintosh HD:Users:fridayge:work:[list.xls]list'!A1, then get value of A1
    In numbers, how can I get this?

    Friday,
    If you can't combine documents for some reason, there are ways to mitigate the effects of having them separate.
    I would give the Source and Receiving documents similar names such that reside next to each other in the Finder window when organized by FileName. Also, position the data you need to retrieve at the top of the Sheet that the Source document will display when opened - you could have a small summary table there.
    Now when you are going to do edits, Select both files in Finder, Right-Click ond Select Open, opening both at once. Copy the source data from the convenient cells in the source document then close the Source document and Paste into the Receiving document. Now continue as though the data had transferred by formula.
    Jerry

Maybe you are looking for

  • Error: adobe acrobat elements has encountered a problem and needs to close

    When I right-click to Convert to PDF or Convert to PDF and EMail for .xls, .xlsx, .doc, .docx, .pptx, .ppt, .pub, and .igx items (what I've tried so far), I get the following error: "Adobe acrobat elements has encountered a problem and needs to close

  • A sql suddenly spent more time than before

    9/28号,业务部门发现一条sql运行时间突然增长,原来只需1秒,现在要10秒左右. database 10.2.0.4 rac 2node server aix 5.3 语句如下: update J_ORGANIZATION c set c.MODIFY_TIME = sysdate, c.MODIFY_EMPL_ID = 1111 where 1 = 1 and c.ORG_ID ='BJ0000270551' and c.DEAL_STATUS = '1' : 检查执行计划,发现没有显著影

  • Vendor account details not coming in MKVZ

    I Created one vendor account through transaction Fk01, but when i go to transaction MKVZ to see all details of vendor created by me , it shows the vendor name in F4 help, but does not show me any details. Can anybody please tell me whats the problem.

  • Edit Digital ID Email Addy

    I just realized the email address I've been using for my digital ID in Acrobat 8 for the past two years is misspelled and I do not know how to correct it (I always saw "my_email_address@gmai..."  because the column was cut-off/not wide enough, so I t

  • MS SQL to Oracle Integration.

    Hi, I want to load data from MS SQL to Oracle using interface. Can anybody tell me what are the steps to do this using ODI tool ? Which LKM,IKM I should use for this ? Thanks in advance, Shrinvas Edited by: 878809 on Aug 25, 2011 12:39 AM