Combining rows to remove blank entries

Hi,
I have searched the forum to try and find an example of the problem I am having but
have not had any luck finding anything. Some help would be appreciated.
I am currently using Oracle 9i.
The problem is that I have a query, returning results as shown below
and I want to remove as many null values as possible.
Goals , Team1 , Team2
1 , Jim , NULL
1 , John , NULL
1 , NULL , Bob
2 , Harry , NULL
2 , NULL , Steve
3 , Jill ,NULL
3 , NULL , Penny
3 , NULL , Sally
The Goals column is numeric, is not unique and is always filled.
The Team1 column contains a name or is null.
The Team2 column contains a name or is null.
Either Team1 has a non null value or Team2 has a non null value.
They cannot both be filled or both be blank.
The result set I would like is an order on Goals, where we collapse the results as much as possible.
So that if a non null Team1 row and Team2 row exist for a given number of goals, they are shown on the same row.
We repeat this till all results are shown for a given number of goals.
If there are more results in Team1 than Team2 say for a given goals scored, we show the team1 result and null for team2 and vice versa.
If the Team1 and Team2 values can be sorted on name within the same goals scored, this would be great as well
To visualise this, the table would look like: -
Goals , Team1 , Team2
1 , Jim , Bob
1 , John , NULL
2 , Harry , Steve
3 , Jill , Penny
3 , NULL , Sally
Thanks for the help,
Rich

Here's an approach.
ME_XE?with
  2     data as
  3  (
  4     select 1 as goals , 'Jim' as team1 , NULL as team2 from dual union all
  5     select 1 as goals , 'John' as team1 , NULL as team2 from dual union all
  6     select 1 as goals , NULL as team1 , 'Bob' as team2 from dual union all
  7     select 2 as goals , 'Harry' as team1 , NULL as team2 from dual union all
  8     select 2 as goals , NULL as team1 , 'Steve' as team2 from dual union all
  9     select 3 as goals , 'Jill' as team1 ,NULL as team2 from dual union all
10     select 3 as goals , NULL as team1 , 'Penny' as team2 from dual union all
11     select 3 as goals , NULL as team1 , 'Sally' as team2 from dual
12  ),
13     set_one as
14  (
15     select goals, team1, row_number() over (partition by goals order by team1 asc) as rn
16     from data
17     where team1 is not null
18     order by team1 asc
19  ),
20     set_two as
21  (
22     select goals, team2, row_number() over (partition by goals order by team2 asc) as rn
23     from data
24     where team2 is not null
25     order by team2 asc
26  )
27  select NVL(s1.goals, s2.goals), team1, team2
28  from set_one s1 FULL OUTER JOIN set_two s2
29  ON (s1.goals = s2.goals and   s1.rn = s2.rn)
30  order by s1.goals asc
31  /
NVL(S1.GOALS,S2.GOALS) TEAM1           TEAM2
                     1 Jim             Bob
                     1 John
                     2 Harry           Steve
                     3 Jill            Penny
                     3                 Sally
5 rows selected.

Similar Messages

  • Removing blank rows in Presentation

    Hi,
    How can i remove blank rows in a Bi Bean Presentaion?
    do i have to configure it in
    a)while making the presentation, or
    b)when displaying it in a JSP page?
    thanks,
    Vaibhav.

    the method is setSuppressRows in class
    oracle.dss.dataSource.client.QueryClient
    you must retreive the Query of your Presentation (Crosstab ThinCrosstab...) and then apply this method to the query...
    After you use it,please reply here if it works,because it does not work to me...
    Antonio

  • Blank entry removed from af:selectOneChoice drop down on valueChangeListene

    I am using af:selectOneChoice component which is getting populated with values from DB. when the page is loaded first time, I can see one blank entry in this component. I have valueChangeListener set on this. when i change the value, the blank entry is removed.
    Can anyone help me with the reason or how can i retain that blank entry.

    Hi I am using following code for jsp page:
    <af:selectOneChoice id="xyz" valueChangeListener="#{abc.xyzChanged}" value="#{abc.strxyz}" autoSubmit="true" styleClass="formfield">
    <f:selectItems value="#{abc.arrayList}"/>
    </af:selectOneChoice>
    Following is the code in BKB class which populates this drop down:
                        AttributeValuesDTO attributeValuesDTO =
                             (AttributeValuesDTO)attrList.get(i); //attrList is list of values fetched from DB
                        arrayList.add(
                                  new SelectItem(
                                            attributeValuesDTO.getAttributeValue(),
                                            attributeValuesDTO.getAttributeValue()));
    I think that adding an extra blank entry is feature of af:selectOneChoice (please correct me) however that extra blank entry is removed when i trigger an action on valueChangeListener for af:selectOneChoice.

  • Data Merge - Not removing blank lines when more than one in a row

    I am having the same problem as mentioned here: http://forums.adobe.com/message/2109531#2109531  That post is for some reason set as "answered" though the poster said the latest update did not resolve the issue.  Has anyone found a solution to this issue?
    Thanks much,

    I"d suggest you try running the merge WITHOUT removing blank lines, then use  GREP to remove empty paragraphs. There's a pre-written saved query in the list.
    Peter

  • Remove Blank Values from Slicer in Power View

    Hi all,
    I am trying to create a power view report from a power pivot data model. After creating the model when I try to use the slicer in power view I am seeing the Blank record. Then I checked that dimension in model where I don't have any blank value in there.
    Also I checked in fact table where it has a relationship with that dimension and I don't see any blank value there as well.
    I am currently blocked with this issue. Experts please jump in and give some ideas how to remove blank value from there.
    Thanks

    As MM-99 already stated correctly, the BLANK-member is created if there is one or more non-matching row in your fact-table that does not exist in the dimension-table
    maybe you have some issues with upper and lower case?
    or maybe there are some whitespace characters contained in the text?
    to identify the issues you may want to create a calcuated column in your fact-table as =RELATED('DimTable'[MyKeyColumn])
    then you can filter on that column and see if any blank values appear
    hth,
    gerhard
    Gerhard Brueckl
    blogging @ http://blog.gbrueckl.at
    working @ http://www.pmOne.com

  • Blank entry in table t512z

    Hi,
    We have a blank entry in t512z in production, and in development its not allowing us to create an blank entry.
    Can any one suggest me how to remove this blank entry from production.
    Thanks
    Veer

    goto se16 and display all the values in T512Z not in V_t512z.
    Please let us know if all the columns are blank.
    I think it should be because of the prev WT in the table is delimited and new entry is created.
    Thanks,
    Amosha

  • How to reject external table rows with some blank columns

    How to reject external table rows with some blank columns
    I have an external table and I would like to reject rows when a number of fields are empty. Here are the details.
    CREATE TABLE EXTTAB (
    ID NUMBER(10),
    TSTAMP DATE,
    C1 NUMBER(5,0),
    C2 DATE,
    C3 FLOAT(126)
    ORGANIZATION EXTERNAL (
    TYPE ORACLE_LOADER
    DEFAULT DIRECTORY EXT_DAT_DIR
    ACCESS PARAMETERS (
    RECORDS DELIMITED BY NEWLINE
    LOAD WHEN (NOT (c1 = BLANKS AND c2 = BLANKS AND c3 = BLANKS))
    LOGFILE EXT_LOG_DIR:'exttab.log'
    BADFILE EXT_BAD_DIR:'exttab.bad'
    DISCARDFILE EXT_BAD_DIR:'exttab.dsc'
    FIELDS TERMINATED BY "|"
    LRTRIM
    MISSING FIELD VALUES ARE NULL
    REJECT ROWS WITH ALL NULL
    FIELDS (
    ID,
    TSTAMP DATE 'YYYYMMDDHH24MISS',
    C1,
    C2 DATE 'YYYYMMDDHH24MISS',
    C3
    ) LOCATION ('dummy.dat')
    REJECT LIMIT UNLIMITED
    So, as you can see from the LOAD WHEN clause, I'd like to reject rows when C1, C2 and C3 are empty.
    The above statement works fine and creates the table. However when I am trying to load data using it, the following error is produced:
    ORA-29913: error in executing ODCIEXTTABLEOPEN callout
    ORA-29400: data cartridge error
    KUP-00554: error encountered while parsing access parameters
    KUP-01005: syntax error: found "not": expecting one of: "double-quoted-string, identifier, (, number, single-quoted-string"
    KUP-01007: at line 1 column 41
    ORA-06512: at "SYS.ORACLE_LOADER", line 14
    ORA-06512: at line 1
    It seems that external tables driver does not understand the "NOT (...)" condition. Could anyone suggest how I can achieve what I want in a different way?
    Thank you.
    Denis

    Another method would be to simply remove the "LOAD WHEN condition" and create a view on the external table which filters the data.
    CREATE EXTTAB_VIEW AS
    SELECT * FROM EXTTAB
    WHERE not (c1 is null and c2 is null and c3 is null);

  • Remove default entry from drop down

    How can i remove the default entry from a dropdown element?
    Florin

    Hi Florin,
    If you are using DropDownByKey, just setting the current selection to some key value will remove the default blank entry.
    wdContext.current<node name>Element().set<attribute>(<key value of the selected data>);
    This will set the value corresponding to this key as the currently selected one in the dropdown and along with this, the default entry will also disappear
    Hope this helps,
    Best Regards,
    Nibu.

  • Remove all entries in sub csv list from parent csv list?

    I have two csv files, one is a complete (parent) list, the other is a sub list. I want to remove all sub-list entires from the parent list. Without manually removing each entry from the parent list one at a time, is there an effecient way to remove all sub list entries from parent list in one simple effort?
    Each list contains email addresses, I want to exclude the sub list from the parent list for the next mailing as they have already completed an action.
    Example:
    Parent list (csv1) has A, B, C, D, E
    Sub list (csv2) has B, D
    How can I remove B & D from Parent list in a concise action?
    Thanks!

    Hi smashart,
    Ian has given you a method that requires manual removal of the unwanted values from the Parent list. My preference would be for a method that constructs a new sub list that includes only the items wanted, but does not affect the original parent list data.
    Like Ian's method, this requires opening both the parent list and the existing sub list of addreses not wanted as separate tables in the same Numbers document.
    Here's an example:
    Two formulas are required.
    Parent::C2, and filled down: =IF(COUNTIF('Sub 1 (have acted)' :: $A,B2)>0,"",MAX($C$1:C1)+1)
    This creates the index shown in column C of Parent. This column may be hidden.
    Sub 2::A2, and filled down: =IF(ROW()-1>MAX(Parent :: $C),"",LOOKUP(ROW()-1,Parent :: $C,Parent :: $B))
    This uses LOOKUP to copy the indexed addresses to Sub 2.
    (Note: Close examination of the addresses in Sub 1 will show a repeated address. As can be seen, this does not affect its removal from the list in Sub 2.
    Regards,
    Barry

  • Combine rows based on column value

    I'm trying to combine rows based off of a common value.
    Table Data:
    Result A
    Player_ID   Player_Name  Team_Name  Points Sequence
    99999       John Smith    Bulls              50         1
    99999       John Smith    Pistons          14         2
    What i want in the output
    Result B
    Player_ID Player_Name Team_Name  Points
    99999     John Smith      Bulls           64 (50 for Bulls)Here's my main query...
    select player_id, player_name, team_name, points
    from
              SELECT player_id, player_name, team_name, sum(points) sum_points
              FROM stats_data
              WHERE season_id = 2008
              AND points > 0
              GROUP BY player_id, player_name, team_name
              ) t
    ORDER BY sum_points DESC, last_name;**The current query gives me the output from Result A
    1) Not entirely sure how to combine data based of player_id
    2) Once i figure out 1, im sure by adding the ('sum_points' for 'team_name') to the output can be done with a case statement, i think?

    Sorry about that Frank.
    Using: Oracle 10.2g
    i was incorrect about the output of the query
              SELECT player_id, sum(points) sum_points
              FROM stats_data
              WHERE season_id = 2008
              AND points > 0
              GROUP BY player_id
    )Output
    Player_ID      Sum_Points    
    99999              20        
    55455               6          
    66489               2  So the subquery is outputing the correct data
    The output of the original entire query(that you had posted) is:
    Player_ID    Player_Name   Team_Name    Points    
    99999        John Smith      Bulls               16 (8 for  Bulls)    
    55455        Bob Johnson    Rockets          6   (3 for Rockets)
    66489        Chris Terry       Kings              2   (1 Kings)Here's some more raw sample data from the table:
    Player_ID    Player_Name   Team_Name    Points     Sequence  Game_Type_ID Team_ID
    99999        John Smith      Bulls               12          1                       1                  5
    99999        John Smith      Bulls               0            1                      -1                  5
    99999        John Smith      Pistons            4           2                       1                 12
    99999        John Smith      Pistons            0           2                       -1                12
    55455        Bob Johnson    Rockets          4           1                        1                  3 
    55455        Bob Johnson    Rockets          0           1                       -1                  3 
    66489        Chris Terry       Kings              2           1                        1                  8
    66489        Chris Terry       Kings              0           1                       -1                  8So your code frank is very close, the issue is that:
    A) All players have a ('pt value' for 'team name') even if they played on the same team, which can prob. be solved with a case statement, which i tried to do in my last post.
    WITH       grouped_data     AS
              SELECT player_id, sum(points) sum_points
              FROM stats_data
              WHERE season_id = 2008
              AND points > 0
              GROUP BY player_id
    SELECT     g.player_id
    ,     s.player_name
    ,     s.team_name
    (case when sequence = 2 then g.sum_points  <==
         ||  '('
         ||  TO_CHAR (s.points)
         ||  ' for '
         ||  s.team_name
         || ')'
    else to_char (g.sum_points)
    END)     AS points
    FROM     grouped_data     g
    JOIN     stats_data     s     ON g.player_id     = s.player_id
    WHERE     s.sequence     in (1,2)     <==
    AND     s.season_id     = 2008
    AND     s.points     > 0;the output has two issues, for players who played on more than one team, like Josh Smith the output comes out as
    99999        John Smith      Pistons           20  (2 for Pistons)        
    99999        John Smith      Bulls               20While the players who played on one team came out correctly. So issue with my edit of your code is:
    A) josh smith is output 2, needs to be output once
    B)josh smith should say (Josh Smith Bulls 20 (4 for Pistons) not "99999 John Smith Pistons 20 (2 for Pistons)"
    c) Issues with "99999 John Smith Pistons 20 (2 for Pistons)" is that it listing the wrong team for him: should be Bulls and listing half of his total with the pistons in the prentices should be 4. --The reason that is because s.points needs to be summed as based off of the data there's two entries
    Hope this clears it up, thanks!
    Edited by: user652714 on Mar 11, 2009 9:28 AM

  • WebDynpro Java: how to remove blank element from Table and Dropdown.

    Hi  Folks
    In a webdynpro application,
    I created a table and witten the below code to populate the table
         IPrivateDummyView.IFirst_TableElement First_Table_Element = null;
         First_Table_Element = wdContext.nodeFirst_Table().createFirst_TableElement();
         First_Table_Element.setF_Value("One");
         wdContext.nodeFirst_Table().addElement(First_Table_Element);
         First_Table_Element = wdContext.nodeFirst_Table().createFirst_TableElement();
         First_Table_Element.setF_Value("2");
         wdContext.nodeFirst_Table().addElement(First_Table_Element);
    As per the code, i got 2 row in the table.
    But , i have one Empty row on top of the table ,  how to get ride of this.
    i find the same problem happening with dropdown too, where i used DDBI, i populated a the content as mention, but i initial 2 row as blank and then i have my own elements ,as per my code.

    >
    > how to remove blank element from Table and Dropdown
    >
    Change selection property of related node to from 0..1 to 1..1 (mandatory)
    Re: DropdownByIndex and empty line (Thread: DropdownByIndex and empty line )
    Re: Can the empty selection be removed from element dropdownbykey(Thread: Can the empty selection be removed from element dropdownbykey )
    Edited by: Anagha Jawalekar on Nov 18, 2008 10:28 PM

  • Blank entry in adhoc query

    Hi All,
    Im have created a data source with table joins T001W and T134M.
    Filed MANDT has been maintained when the join condition has been established at Data source level.
    Adhoc query in business rule identifies the deficiency. But some filed in the result has blank entry.
    Attached the screen shot for your reference.
    Can you please let me know, how to fix the blank entry issue.
    Thanks
    Ashok S

    Hello Ashok,
    In this case, you have foundation and plug-in in both systems. I assume you have set data source and business rules in GRC system, am I right?
    If this is the case, you might have several problems as before SP 10 for GRC 10.0, backwards compatibility was not implemented yet. It means that you must follow SAP note 1352498 in order to synchronize your systems.
    If this is not the case, have you checked these values in SCU3 in ECC system?
    Best Regards,
    Fernando

  • Blank entry is not getting updated in r/3?

    Hi Gurus,
    I have a webdynpro application which has user input field where in which user can pass the data and it will get updated once user hit the update button in the view.
    But in some case if user don't enter any value in the above said input box it has to update the r/3 with the blank entry.
    But in my case r/3 system refers the value (which is passed from portal last time) instead of blank entry?
    How to overcome this problem.
    Please Help
    Thanks in Advance,
    Dharani

    Hi,
    Suppose you are using a function Module X  which takes input "empno"  ..., and exports name, city , rcode
    Go to se37 ,  check the code ....it can be like this ...
    if empno = .... then
    update .......
    // updated
    else
    // not updated ........
    end if .
    if updated ... u will observer 0 else some other number say 4.
    Now when u  do modelling in your webdynpro application , u can find export parameters know..
    now u can check ...if rcoe = 0 ..updated else ...not updated ...
    by that u can know...
    Thanks,
    Srini

  • How to remove blank pages

    Dear all,
    How can i remove blank pages in combind pdf in one short, if you have any idea or suggestion for remove blank pages in Acrobat. We need without blank pages counting for final page count purpose.
    We tried to remove blank pages option in acrobat 9.0, but it is not use single short. It is taken more time to taken for maual work.
    If you have any scripting for this? or any option having in acrobat in single short? Please help me in this regard.
    Thanks
    kanaga kumar. k

    This can be done with a script, but a script can only assume a page is
    blank if it has not text in it. It can't know if there are images or other
    graphic elements in a page.

  • Flex Table Add Row Issue with Dynamic Entry Lists in Visual Composer

    All,
    Your help would be kindly appreciated in resolving an 'Add Row'-issue within a Flex Table that uses Dynamic Entry Lists in Visual Composer. The issue here is as follows :
    When I use a [Local Dynamic Entry List |http://www.postyourimage.com/view_image.php?img_id=O5hrG2aMxWZ84Mu1211193041]to populate a row field, the initial row and all next rows are emptied upon 'insert row', they loose their selected values and also the entry list values ('pull-down menus') are lost. Please also see [screenshot|http://www.postyourimage.com/view_image.php?img_id=FPLr2cABcgiHRou1211192889].
    The initial row does [show the entry list values |http://www.postyourimage.com/view_image.php?img_id=2HybmEHAuQYs9cg1211192766]from the Local Dynamic Entry List based on the dynamically assigned input value; upon 'insert row' the entry lists are lost. Please also see [screenshot|http://www.postyourimage.com/view_image.php?img_id=FPLr2cABcgiHRou1211192889].
    When using a [Global Dynamic Entry List |http://www.postyourimage.com/view_image.php?img_id=m5p2KYuBb442dTq1211193501]to populate the row fields the Flex-table behaves normally as expected. Unfortunately with a Global Entry List it is not possible to dynamically assign a input value. Please also see [screenshot|http://www.postyourimage.com/view_image.php?img_id=U96V0zENCCyO3gA1211193157].
    Please also see the [issue summary image|http://www.postyourimage.com/view_image.php?img_id=06xti08tIEfely1211195178] I made to visualize the issue.  What I basically would like to know is whether this is a 'known issue' or not, or that it is an issue that can be fixed or whether there is an alternative workaround available ... I'm using Visual Composer 7.0 and the Portal is at SP 13.
    Many thanks,
    Freek

    Hi,
    you should be able to assign a dynamic value with global entry lists as well. If you say @myParam as dynamic value. VC will indicate in red letters, that the field @myParam is unknown. However, it will work, as long as @myParam is known in the form or table where you use the entry list.
    I have never heard of the problem that entry lists are emptied after "insert"-event.
    Kindes Regards,
    Benni

Maybe you are looking for