Selecting which rows to sum in ss

Hi, I have a spreadsheet that keeps track of scores in an inter-club series. Each competitor has a row, and one of the columns is the competitor's club and the rest are scores. Now at the bottom I have rows for each club, and I would like to sum all scores from all competitors belonging to each club.
So for example, Column C is the club name, column M is the competitor's total points. I have one club called MCO. The formula I have thought of for the club total is, =IF(C17="MCO",M17,0)
which checks the competitor in row 17 and adds his score if he is an MCO member. BUT! How do I get it to check ALL the competitors, from row 17 to row 100, for MCO membership, and add the relevant scores to the MCO total? I don't know the right syntax to write such a formula.
Thank you.

You'll need to treat the calculation in two parts—use the formula you have to transfer a competitor's score to another column IF that competitor is a member of MCO, then SUM that column.
Score table runs from row 17 to row 100
Column C is the club name
Column M is the competitor's total points.
There are six clubs.
MCO scores will be transfered to column N and totaled in N101
Part 1
N16: enter MCO
Continue to the right, entering one club name in each column until all clubs are entered. (eg. R16 will contain ZZZ, the name of the sixth club.)
N17: enter =IF($C17=N$16,$M17,"")
Select N17..R100
Press command-R to fill the formula Right to R17.
Press command-D to fill the formula Down to row 100.
AppleWorks will revise the formula to fit each new cell.
The formula in R16 should read: =IF($C17=R$16,$M17,"")
The formula in R100 should read: =IF($C100=R$16,$M100,"")
Part 2
N101: enter =SUM(N17..N100)
Select N101..R101
Press command-R.
Regards,
Barry

Similar Messages

  • Has anyone retrieved a value from a system Matrix from selecting the row

    Hi everyone, I am trying to retrieve the value of a cell from the first column of a matrix depending on which row the user has highlighted.  I can access the value from specifying which row to retrieve the value from but not from the user selecting which row.   Im attempting do do this from the open items list system form which is accessed from the reports menu. 
    To retrieve the value from the first row my code is as follows:
    oMatrix = oForm.Items.Item("5").Specific
    DocNo = oMatrix.Columns.Item("1").Cells.Item(1).Specific.Value
    SBO_Application.MessageBox(DocNo)
    How do I change this code to access the value of the cell depending on which row is highlighted?
    Any help would be appreciated

    Hi Sally,
    you will get the selected row number on any event through "pVal.Row", you can get this value in a integer variable like:
    int i = pVal.Row
    and pass it in your code;
    DocNo = oMatrix.Columns.Item("1").Cells.item(i)
    or you can do same in this way also:
    you have to specify your particular cell as a edit text and get the value of that:
    oEditText=(SAPbouiCOM.EditText)oMatrix.Columns.Item("1").Cells.Item(i).Specific;
    string1 = oEditText.String;
    Hope it will help.

  • How can I restrict the rows of a SELECT which uses analytical functions?

    Hello all,
    Can anyone please tell me how to restrict the following query:
    SELECT empno,
    ename,
    deptno,
    SUM(sal) over(PARTITION BY deptno) sum_per_dept
    FROM emp;
    I would need just the lines which have sum_per_dept>100, without using a SUBSELECT.
    Is there any way which is specific for analytical functions?
    Thank you in advance,
    Eugen
    Message was edited by:
    misailescu

    SQL> select empno,
      2  ename,
      3  deptno,sum_per_dept
      4  from
      5  (
      6  SELECT empno,
      7  ename,
      8  deptno,
      9  SUM(sal) over(PARTITION BY deptno) sum_per_dept
    10  FROM emp
    11  )
    12  where sum_per_dept>1000;
    EMPNO ENAME      DEPTNO SUM_PER_DEPT
    7839 KING           10         8750
    7782 CLARK          10         8750
    7934 MILLER         10         8750
    7902 FORD           20         6775
    7369 SMITH          20         6775
    7566 JONES          20         6775
    7900 JAMES          30         9400
    7844 TURNER         30         9400
    7654 MARTIN         30         9400
    7521 WARD           30         9400
    7499 ALLEN          30         9400
    7698 BLAKE          30         9400
    12 rows selected
    SQL>
    SQL> select empno,
      2  ename,
      3  deptno,sum_per_dept
      4  from
      5  (
      6  SELECT empno,
      7  ename,
      8  deptno,
      9  SUM(sal) over(PARTITION BY deptno) sum_per_dept
    10  FROM emp
    11  )
    12  where sum_per_dept>9000;
    EMPNO ENAME      DEPTNO SUM_PER_DEPT
    7900 JAMES          30         9400
    7844 TURNER         30         9400
    7654 MARTIN         30         9400
    7521 WARD           30         9400
    7499 ALLEN          30         9400
    7698 BLAKE          30         9400
    6 rows selected
    SQL> Greetings...
    Sim

  • Knowing which Row was selected when Hide/Show is clicked

    Hi everyone,
    I have an advanced table, with some search criteria that works. I have added a "detail" flag and when I click the link Hide/Show, the details are displayed.
    How can I get in the code which Hide/Show link was clicked? I am more interesting in getting the Row from the VO which the Hide/Show link was clicked?
    When I get the "event" parameter from the pageContext (pageContext.getParameter("event") ) it returns "hide" or "show", but I don't know which was row that was clicked.
    What I am trying to accomplish is the following. In my advanced table I have "Select" checkBoxes. I want to add the "Hide/Show details" functionality and try to have the details displayed in an advanced table with its own "Select" checkBoxes.
    Can it be done?

    Hi,
    Create a Primary Key in View Object's Query for the table.
    Now to know on which row hide/show has been clicked you need to capture the row reference which is nothing but Primary Key for that row.
    Use this code in processformrequest:
    if(("hide".equalsIgnoreCase(pageContext.getParameter("event"))))
    String rowReference = pageContext.getParameter(OAWebBeanConstants.EVENT_SOURCE_ROW_REFERENCE);
    TestMassDeleteSearchVORowImpl row = (TestMassDeleteSearchVORowImpl)am.findRowByRef(rowReference);
    String lname = (String) row.getSelectFlag();//to get the value of checkbox
    Thanks,
    Gaurav

  • Selecting which Albums in Appear in  Front Row

    Hello All,
    I like the idea that iPhoto albums appear in Front Row. However, as my list of albums grow, this could get hard to use. Is there any way to select which iPhoto albums appear in Front Row?
    Thanks in advance
    Kantron

    Not that I know of. FR shows galleries, keepsakes, albums and slideshows. After the last import the albums are listed in the order that they are in the Albums section. Put those you want least at the bottom of that list. The same goes for galleries, keepsakes and slideshows.
    TIP: For insurance against the iPhoto database corruption that many users have experienced I recommend making a backup copy of the Library6.iPhoto (iPhoto.Library for iPhoto 5 and earlier versions) database file and keep it current. If problems crop up where iPhoto suddenly can't see any photos or thinks there are no photos in the library, replacing the working Library6.iPhoto file with the backup will often get the library back. By keeping it current I mean backup after each import and/or any serious editing or work on books, slideshows, calendars, cards, etc. That insures that if a problem pops up and you do need to replace the database file, you'll retain all those efforts. It doesn't take long to make the backup and it's good insurance.
    I've created an Automator workflow application (requires Tiger or later), iPhoto dB File Backup, that will copy the selected Library6.iPhoto file from your iPhoto Library folder to the Pictures folder, replacing any previous version of it. There are versions that are compatible with iPhoto 5, 6, 7 and 8 libraries and Tiger and Leopard. Just put the application in the Dock and click on it whenever you want to backup the dB file. iPhoto does not have to be closed to run the application, just idle. You can download it at Toad's Cellar. Be sure to read the Read Me pdf file.
    NOTE: The new rebuild option in iPhoto 09 (v. 8.0.2), Rebuild the iPhoto Library Database from automatic backup" makes this tip obsolete.

  • How to select only rows which column has a null value?

    Hi,
    I adds rows to my table with data field set to null;
    "INSERT INTO administrator.subzamowienia (subzamowienia.id_zamowienia,subzamowienia.id_transakcji,subzamowienia.nazwa_o,subzamowienia.nazwa_produktu,subzamowienia.ilosc,subzamowienia.nip_d,subzamowienia.data_realizacji) VALUES (administrator.id_zamowienia.curval,'0','PRAGA','Witaminy','2','43224','0');"
    Then i would like to update this field after a time with new date.
    To do this i need to know which rows has still data field set to null, i try sth like this but it doesn't work
    "SQL> select * from administrator.subzamowienia where subzamowienia.data_realizacji='null';
    select * from administrator.subzamowienia where subzamowienia.data_realizacji='null'
    BŁĄD w linii 1:
    ORA-01841: (pełny) rok musi być pomiędzy -4713 i +9999 i nie może być 0
    or
    "SQL> select * from administrator.subzamowienia where subzamowienia.data_realizacji='0';
    select * from administrator.subzamowienia where subzamowienia.data_realizacji='0'
    BŁĄD w linii 1:
    ORA-01840: wartość wejściowa jest za krótka dla formatu daty
    how to choose this rows?

    Hi,
    VALUES (administrator.id_zamowienia.curval,'0','PRAGA','Witaminy','2','43224','0');I don't see null value...
    select * from administrator.subzamowienia where subzamowienia.data_realizacji='null'Should be :
    select * from administrator.subzamowienia where subzamowienia.data_realizacji is nullNicolas.

  • All numeric items are summing up, also items which cannot be summed up

    i use numeric items (e.g. analysis #) at cross table layout at datapoint place.
    when i drill up from left axis, all numeric items are summing up, also the items which cannot be summed up - its not correct.
    how can i avoid to summary up these number colums.
    Desktop-Client 9.0.2.54.01
    Discoverer Administrator-Client 9.0.2.54.01

    This items already not defined as data points in the admin, however I used these on desktop client as data points.
    But there is now an interesting detail: not always all detail lines are summarized on problematic items (e.g. only 2 of 7), but on all other data the detail and sum data are correct.
    Now I checked the SQL-statement and found out, there are some results with more than one rows (different date in same row header on the left side) . The problem because i do not found it, is that, the different time is already a part of an selection parameter in the headline (year,month,day).
    Possible solution: I give the date to the left side additionally.
    Thanks to Russ and Marcos.
    Best regards,
    Walter

  • When selecting a row from a view with a nested table I want just ONE entry returned

    Does a nested table in a view "EXPLODE" all values ALWAYS no matter the where clause for the nested table?
    I want to select ONE row from a view that has columns defined as TYPE which are PL/SQL TABLES OF other tables.
    when I specify a WHERE clause for my query it gives me the column "EXPLODED" with the values that mathc my WHERE clause at the end of the select.
    I dont want the "EXPLODED" nested table to show just the entry that matches my WHERE clause. Here is some more info:
    My select statement:
    SQL> select * from si_a31_per_vw v, TABLE(v.current_allergies) a where a.alg_seq
    =75;
    AAAHQPAAMAAAAfxAAA N00000 771 223774444 20 GREGG
    CADILLAC 12-MAY-69 M R3
    NON DENOMINATIONAL N STAFF USMC N
    U
    E06 11-JUN-02 H N
    05-JAN-00 Y Y
    USS SPAWAR
    353535 USS SPAWAR
    SI_ADDRESS_TYPE(NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NUL
    L, NULL)
    SI_ADDRESS_TAB()
    SI_ALLERGY_TAB(SI_ALLERGY_TYPE(69, 'PENICILLIN', '11-JUN-02', NULL), SI_ALLERGY
    TYPE(74, 'SHELLFISH', '12-JUN-02', NULL), SIALLERGY_TYPE(68, 'PEANUTS', '13-J
    UN-02', NULL), SI_ALLERGY_TYPE(75, 'STRAWBERRIES', '13-JUN-02', NULL))
    SI_ALLERGY_TAB()
    75 STRAWBERRIES 13-JUN-02
    *******Notice the allergy entry of 75, Strawberries, 13-JUN-02 at the
    end. This is what I want not all the other exploded data.
    SQL> desc si_a31_per_vw
    Name Null? Type
    ........ Omitted uneeded previous column desc because of metalink
    character limit but the view is bigger then this.......
    DEPT_NAME VARCHAR2(20)
    DIV_NAME VARCHAR2(20)
    ADDRESSES SI_ADDRESS_TAB
    CURRENT_ALLERGIES SI_ALLERGY_TAB
    DELETED_ALLERGIES SI_ALLERGY_TAB
    SQL> desc si_allergy_tab
    si_allergy_tab TABLE OF SI_ALLERGY_TYPE
    Name Null? Type
    ALG_SEQ NUMBER
    ALG_NAME VARCHAR2(50)
    START_DATE DATE
    STOP_DATE DATE
    SQL> desc si_allergy_type
    Name Null? Type
    ALG_SEQ NUMBER
    ALG_NAME VARCHAR2(50)
    START_DATE DATE
    STOP_DATE DATE

    Can you explain what do you mean by the following?
    "PL/SQL tables (a.k.a. Index-by tables) cannot be used as the basis for columns and/or attributes"There are three kinds of collections:
    (NTB) Nested Tables
    (VAR) Varrying Arrays
    (IBT) Index-by Tables (the collection formerly known as "PL/SQL tables")
    NTB (and VAR) can be defined as persistent user defined data types, and can be used in table DDL (columns) and other user defined type specifications (attributes).
    SQL> CREATE TYPE my_ntb AS TABLE OF INTEGER;
    SQL> CREATE TABLE my_table ( id INTEGER PRIMARY KEY, ints my_ntb );
    SQL> CREATE TYPE my_object AS OBJECT ( id INTEGER, ints my_ntb );
    /IBT are declared inside stored procedures only and have slightly different syntax from NTB. Only variables in stored procedures can be based on IBT declarations.
    CREATE PROCEDURE my_proc IS
       TYPE my_ibt IS TABLE OF INTEGER INDEX BY BINARY_INTEGER;  -- now you see why they are called Index-by Tables
       my_ibt_var my_ibt;
    BEGIN
       NULL;
    END;That sums up the significant differences as it relates to how they are declared and where they can be referenced.
    How are they the same?
    NTB and VAR can also be (non-persistently) declared in stored procedures like IBTs.
    Why would you then ever use IBTs?
    IBTs are significantly easier to work with, since you don't have to instantiate or extend them as you do with NTB and VAR, or
    Many other highly valuable PL/SQL programs make use of them, so you have to keep your code integrated/consistent.
    There's a lot more to be said, but I think this answers the question posed by Sri.
    Michael

  • Not able to select a row in ALV?

    Hi Experts,
    I am enhancing a standard e-recruiting WD ABAP component.
    It produces a search result as ALV.
    I am not able to select any row in ALV by clicking it like we normally do in ALV.
    I wrote below code to allow selection:
    lo_value->if_wd_salv_table_settings~set_selection_mode( cl_wd_table=>e_selection_mode-single).
    Even after this I am not able to select any row by clicking it.
    Need help to solve this.
    Regards,
    Sumit Oberoi

    Hi,
    To have the inputfields for the ALV.
    Get the column references of the ALV table and for each column rference create a inputfield object
    type CL_SALV_WD_UIE_INPUT_FIELD.
    lo_value is model object.
      CALL METHOD lo_value->if_salv_wd_column_settings~get_columns
        RECEIVING
          value = wd_this->lit_columns.
    LOOP AT wd_this->lit_columns INTO wd_this->lis_columns.
          lv_id = wd_this->lis_columns-id.
          wd_this->gref_column = wd_this->lis_columns-r_column.
    case lv_id.
    when ' colname'.
                CREATE OBJECT lr_input
                  EXPORTING
                    value_fieldname = lv_id.
                CALL METHOD wd_this->gref_column->set_cell_editor
                  EXPORTING
                    value = lr_input.
    when ' colname'.
                CREATE OBJECT lr_input
                  EXPORTING
                    value_fieldname = lv_id.
                CALL METHOD wd_this->gref_column->set_cell_editor
                  EXPORTING
                    value = lr_input.
    endcase.
    endloop.
    Or you can take a attribute READ_ONLY for the node to which ALV table is bound.
    Set the readonly property to abap_false (for input field) by looping through the table.
    Get the column references and get the textview reference for each column and use the set_read_only
    method by passing the attribute name.
    This way the textview will now become the inputfield when the read_only property is set to abap_false.
    Regards,
    Lekha.

  • How can I display "detailStamp" facet selectively for rows in a table ?

    Hi,
    My JDEV version is Studio Edition Version 11.1.1.5.0
    I am trying to display "detailStamp" facet selectively .
    If I read api in link below
    http://docs.oracle.com/cd/E26098_01/apirefs.1112/e17488/oracle/adf/view/rich/component/rich/data/RichTable.html
    Use the "detailStamp" facet on the Table to include a collapsable content area for each table row. Please note that the height of the open detail area will be a set height based on the height of the detailStamp component. Adding a component that changes in height (like showDetail or panelBox) will by default produce strange results when the detailStamp component's height changes.
    Detail Stamp can be selectively displayed for rows in the table by EL binding the "rendered" attribute of the "detailStamp" facet to "true" or "false". The EL binding can contain references to the table "var" attribute since during rendering it will be executed in the context of the row. Disclosure icon is displayed only for rows which have rendered="true".
    I can see that i can achieve it by setting rendered property for that facet. BUT this property is not available in Studio Edition Version 11.1.1.5.0

    Hi Frank.
    Thanks for your quick reply .
    But I am using Studio Edition Version 11.1.1.5.0 . In this version the property RENDERED of f:facet name="detailStamp" is NOT allowed.
    Edited by: user13764942 on Feb 7, 2013 5:48 AM
    Put in another way , I want to render the "detailStamp" facet selectively for rows , so for that I need the RENDERED property of "detailStamp" facet. This property is ONLY available in Jdev version 11.2 . I am using Jdev 11.1.1.5.0 so I need some alternative to RENDERED property as this property is NOT available in Jdev 11.1.1.5.0.
    Please suggest some way to achieve this behaviour of displaying "detailStamp" facet selectively ....
    Thanks!
    Edited by: Mangpal Singh on Feb 7, 2013 11:57 PM

  • How to select multiple rows from List Of Values

    Hello,
    I use ADF 11g to create my list of values (LOV). I want to select multiple rows from it. but i can't.
    so how i can select many rows to set them in my adf table.
    Thank in advance

    Hi,
    LOV is map to an attribute in the viewObject so it will return only one value or more values from selected row. You can't select multiple rows from LOV.
    But you can do this by using popup which you can select multiple rows and insert the selected rows to another table.
    This blog post explain how to achieve this :
    http://husaindalal.blogspot.com/2009/11/search-from-popup-and-add-to-new-table.html#comments
    Sameh Nassar

  • F4IF_INT_TABLE_VALUE_REQUEST select entrie row

    Hello All,
    I have a VALUE_TAB internal table (<b>it_mngrp_mncod</b>) with 3 fileds. After selecting a row in F4 pop up, I need to get all the three column values. In return_tab I am getting only the last field, which is the value of CODE in it_mngrp_mncod. Is there any way to select the entire row in F4 pop up?
    Here is the piece of my code:
    *& Report  ZCK_TEST
    REPORT  zck_test.
    TABLES: viqmel, viqmfe.
    CALL SCREEN 101.
    *&      Module  code_pf4_i15  INPUT
    MODULE code_pf4_i15 INPUT.
      DATA: BEGIN OF it_mngrp_mncod OCCURS 0,
                 kurztext TYPE qtxt_code,
                 codegruppe TYPE qcodegrp,
                 code TYPE qcode,
                 END OF it_mngrp_mncod.
      DATA: it_returntab LIKE ddshretval OCCURS 0 WITH HEADER LINE.
      DATA: it_fieldtab LIKE dfies OCCURS 0 WITH HEADER LINE.
      DATA p_field TYPE fieldname.
      GET CURSOR FIELD p_field .
      PERFORM code_pf4_f40 USING p_field.
    ENDMODULE.                 " code_pf4_i15  INPUT
    *&      Form  code_pf4_f40
    FORM code_pf4_f40 USING p_field.
      PERFORM get_f4_values CHANGING  p_field.
    ENDFORM.                    " code_pf4_f40
    *&      Form  GET_F4_VALUES
    FORM get_f4_values  CHANGING    p_field.
      DATA: field1 TYPE fieldname,
             field2 TYPE fieldname.
      DATA: p_katalogart TYPE qkatart.
      SPLIT p_field AT '-' INTO field1 field2.
      IF field2 = 'OTGRP' OR  field2 = 'OTEIL'.
        p_katalogart = 'B'.
      ELSEIF field2 = 'FEGRP' OR  field2 = 'FECOD'.
        p_katalogart = 'C'.
      ELSEIF field2 = 'URGRP' OR  field2 = 'URCOD'.
        p_katalogart = '5'.
      ELSEIF field2 = 'MNGRP' OR field2 = 'MNCOD'.
        p_katalogart = 'A'.
      ELSEIF field2 = 'TASK_CODEGRP' OR field2 = 'TASK_CODE' OR field2 =
    'TXT_TASKCD'.
        p_katalogart = '2'.
      ENDIF.
      SELECT codegruppe code INTO CORRESPONDING FIELDS OF TABLE
    it_mngrp_mncod FROM qpcd WHERE katalogart = p_katalogart.
      LOOP AT it_mngrp_mncod.
        SELECT SINGLE kurztext
                FROM qpct
                INTO it_mngrp_mncod-kurztext
               WHERE katalogart = p_katalogart
                 AND codegruppe = it_mngrp_mncod-codegruppe
                 AND code = it_mngrp_mncod-code.
        MODIFY it_mngrp_mncod FROM it_mngrp_mncod TRANSPORTING kurztext.
      ENDLOOP.
      CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
        EXPORTING
      DDIC_STRUCTURE         = ' '
          retfield               = p_field
      PVALKEY                = ' '
      DYNPPROG               = ' '
      DYNPNR                 = ' '
      DYNPROFIELD            = ' '
      STEPL                  = 0
      WINDOW_TITLE           =
      VALUE                  = ' '
       value_org              = 'S'
      MULTIPLE_CHOICE        = ' '
      DISPLAY                = ' '
      CALLBACK_PROGRAM       = ' '
      CALLBACK_FORM          = ' '
      MARK_TAB               =
    IMPORTING
      USER_RESET             =
        TABLES
          value_tab              = it_mngrp_mncod
         field_tab              =  it_fieldtab
         return_tab             = it_returntab
      DYNPFLD_MAPPING        =
    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.
      ENDIF.
      READ TABLE it_returntab INDEX 1.
      MOVE it_returntab-fieldval TO p_field.
    ENDFORM.                    " GET_F4_VALUES
    *&      Module  user_command_101  INPUT
          text
    MODULE user_command_101 INPUT.
      CASE sy-ucomm.
        WHEN 'BACK'.
          LEAVE TO SCREEN 0.
      ENDCASE.
    ENDMODULE.                 " user_command_101  INPUT
    *&      Module  status_101  OUTPUT
          text
    MODULE status_101 OUTPUT.
      SET PF-STATUS '0101'.
    ENDMODULE.                 " status_101  OUTPUT

    Hi,
    Paste following code as-is just before ENDIF. Then it should work fine.
      data: w_dynpro_field type dynpread.
      data: t_dynpro_field type standard table of dynpread.
      refresh: t_dynpro_field.
      move: sy-repid to d020s-prog,
            sy-dynnr to d020s-dnum.
      move: 'VIQMFE-OTEIL'   to w_dynpro_field-fieldname,
            viqmfe-oteil     to w_dynpro_field-fieldvalue.
      call function 'DYNP_VALUES_UPDATE'
        exporting
          dyname               = d020s-prog
          dynumb               = d020s-dnum
        tables
          dynpfields           = t_dynpro_field
        exceptions
          invalid_abapworkarea = 1
          invalid_dynprofield  = 2
          invalid_dynproname   = 3
          invalid_dynpronummer = 4
          invalid_request      = 5
          no_fielddescription  = 6
          undefind_error       = 7
          others               = 8.
    Hope this helps...
    Thanks,
    Murali

  • How can i select some row from multiple row in the same group of data

    I want to select some row from multiple row in the same group of data.
    ColumnA        
    Column B
    1                  OK
    1                   NG
    2                   NG
    2                          NG
    3                          OK
    3                          OK
    I want the row of group of
    ColumnA if  ColumnB contain even 'NG'
    row , select only one row which  Column B = 'NG'
    the result i want = 
    ColumnA         Column B
    1                         NG
    2                   NG
    3                          OK
    Thank you

    That's some awful explanation, but I think this is what you were driving at:
    DECLARE @forumTable TABLE (a INT, b CHAR(2))
    INSERT INTO @forumTable (a, b)
    VALUES
    (1, 'OK'),(1, 'NG'),
    (2, 'NG'),(2, 'NG'),
    (3, 'OK'),(3, 'OK')
    SELECT f.a, MIN(COALESCE(f2.b,f.b)) AS b
    FROM @forumTable f
    LEFT OUTER JOIN @forumTable f2
    ON f.a = f2.a
    AND f.b <> f2.b
    GROUP BY f.a

  • How can I select the row after a cfgrid refresh?

    I have a form that is bound to a cfgrid.  The grid is populated from a database.  When you navigate in the grid the data displayed in the form changes to match the selected row.  I can edit the data in the form and update the database.  After updating the data I refresh the cfgrid, which then displays the updated data.
    Unfortunately the cfgrid always highlights the first row, row 0, after a refresh.  I want to highlight the same row that was highlighted when the data was edited and saved.  Can anyone advise as to how I can do that?
    I have tried setting a listener when the grid is initiated that responds whenever the store is refreshed and triggers the function refreshSelection():
    g.getStore().on('load', refreshSelection) ;
    Before the form data is saved, the row number is stored in selectedRow[0].  When the grid is refreshed, refreshSelection is run:
    function refreshSelection() {
    if (0 >= selectedRecords.length)
         return;
    alert('Selected row is Row ' + selectedRecords[0] ) ;
    g.getSelectionModel().selectRow(selectedRecords[0]) ;
    selectedRecords[0] = 0 ;
    The alert shows the correct row number each time, but highlighting the last row viewed works intermittently, and only if the alert line is active.  If I comment out the alert, this fails every time, with row 0 being highlighted.  selectedRecords[0] is reset to 0 after the attempt to select the row so that navigation through the grid, such as choosing "Next Page," will properly highlight the first row of the page rather than the last row number that was edited.
    -Rick

    Massage?
    Why not ask the masseuse who gave you the massage?

  • How do I select a row from the middle of a recordset?

    UserID QuestionID Answered
    10 9 N
    10 8 N
    10 7 N
    10 6 N
    10 5 Y
    10 4 Y
    10 1 Y
    From the table sorted by QuestionID DESC, how do I select the first row from the bottom going up with Answered value equal to 'N'?
    Which in the example above would be:
    10 6 N
    I need to select this row and get the QuestionID value equal to 6.
    Right now I have:
    select QuestionID
    from tblMap
    where Answered = 'N'
    and ROWNUM = 1
    order by QuestionID ASC;
    This always the top most row, which would be:
    10 9 N

    Here i used DUAL to generate a list of numbers for me.
    ME_XE?select *
      2  from
      3  (
      4     select row_number() over (order by col1 desc) as rn, count(*) over() as cnt, col1
      5     from
      6     (
      7        select level as col1 from dual connect by level <= 9
      8     )
      9  )
    10  where ceil(cnt/2) = rn
    11  /
                    RN                CNT               COL1
                     5                  9                  5
    1 row selected.
    Elapsed: 00:00:00.07
    ME_XE?Edited by: Tubby on Jul 8, 2009 1:47 PM
    Seems i misread the question :)

Maybe you are looking for