Help with remove reversed duplicate rows?

Hi:
I have an application where I need to remove reversed duplicate rows, such as this:
select 'A' x, 'B' y from dual
union all
select 'C', 'D' from dual
union all
select 'B','A' from dual;
Output is:
X Y
A B
C D
B A
What I need is to remove the 'B A' row because it already exists in reverse form as 'A B'. It does not matter which row is kept, 'A B' or 'B A'. Just one of them needs to be removed and the other needs to stay.
Note that the actual query to generate the data is a little more involved, but I can use a with clause to make it an inline view. I'm hoping that the actual mechanics are not relevant. If that is not the case, please let me know and I'll post more details about the actual query.
Any ideas?

  WITH T AS
( SELECT  'HOUSE' x, 'HOUSE' y FROM DUAL UNION ALL
SELECT 'HOUSE', 'JME0609U' FROM DUAL UNION ALL
SELECT 'HOUSE', 'JME4Q08' FROM DUAL UNION ALL
SELECT 'HOUSE', 'JMEM' FROM DUAL UNION ALL
SELECT 'HOUSE', 'MATCH2' FROM DUAL UNION ALL
SELECT 'HOUSE', 'MATCH3' FROM DUAL UNION ALL
SELECT 'HOUSE', 'PGCM' FROM DUAL UNION ALL
SELECT 'HOUSE', 'PGCU' FROM DUAL UNION ALL
SELECT 'HOUSE', 'VEL' FROM DUAL UNION ALL
SELECT 'HOUSE', 'XXX08' FROM DUAL UNION ALL
SELECT 'JME0609U', 'HOUSE' FROM DUAL UNION ALL
SELECT 'JME0609U', 'JME0609U' FROM DUAL UNION ALL
SELECT 'JME0609U', 'MATCH3' FROM DUAL UNION ALL
SELECT 'JME0609U', 'PGCM' FROM DUAL UNION ALL
SELECT 'JME0609U', 'PGCU' FROM DUAL UNION ALL
SELECT 'JME0609U', 'VEL' FROM DUAL UNION ALL
SELECT 'JME0609U', 'XXX08' FROM DUAL UNION ALL
SELECT 'JMEM', 'HOUSE' FROM DUAL UNION ALL
SELECT 'JMEM', 'JMEM' FROM DUAL UNION ALL
SELECT 'JMEM', 'MATCH3' FROM DUAL UNION ALL
SELECT 'JMEM', 'PGCM' FROM DUAL UNION ALL
SELECT 'JMEM', 'PGCU' FROM DUAL UNION ALL
SELECT 'JMEM', 'VEL' FROM DUAL UNION ALL
SELECT 'JMEM', 'XXX08' FROM DUAL UNION ALL
SELECT 'MATCH2', 'HOUSE' FROM DUAL UNION ALL
SELECT 'MATCH2', 'MATCH2' FROM DUAL UNION ALL
SELECT 'MATCH2', 'MATCH3' FROM DUAL UNION ALL
SELECT 'MATCH2', 'PGCM' FROM DUAL UNION ALL
SELECT 'MATCH2', 'PGCU' FROM DUAL UNION ALL
SELECT 'MATCH2', 'VEL' FROM DUAL UNION ALL
SELECT 'MATCH2', 'XXX08' FROM DUAL UNION ALL
SELECT 'MATCH3', 'HOUSE' FROM DUAL UNION ALL
SELECT 'MATCH3', 'JME0609U' FROM DUAL UNION ALL
SELECT 'MATCH3', 'JMEM' FROM DUAL UNION ALL
SELECT 'MATCH3', 'MATCH2' FROM DUAL UNION ALL
SELECT 'MATCH3', 'MATCH3' FROM DUAL UNION ALL
SELECT 'MATCH3', 'XXX08' FROM DUAL UNION ALL
SELECT 'PGCM', 'HOUSE' FROM DUAL UNION ALL
SELECT 'PGCM', 'JME0609U' FROM DUAL UNION ALL
SELECT 'PGCM', 'JMEM' FROM DUAL UNION ALL
SELECT 'PGCM', 'MATCH2' FROM DUAL UNION ALL
SELECT 'PGCM', 'PGCM' FROM DUAL UNION ALL
SELECT 'PGCM', 'XXX08' FROM DUAL UNION ALL
SELECT 'PGCU', 'HOUSE' FROM DUAL UNION ALL
SELECT 'PGCU', 'JME0609U' FROM DUAL UNION ALL
SELECT 'PGCU', 'JMEM' FROM DUAL UNION ALL
SELECT 'PGCU', 'MATCH2' FROM DUAL UNION ALL
SELECT 'PGCU', 'PGCU' FROM DUAL UNION ALL
SELECT 'PGCU', 'XXX08' FROM DUAL UNION ALL
SELECT 'VEL', 'HOUSE' FROM DUAL UNION ALL
SELECT 'VEL', 'JME0609U' FROM DUAL UNION ALL
SELECT 'VEL', 'JMEM' FROM DUAL UNION ALL
SELECT 'VEL', 'MATCH2' FROM DUAL UNION ALL
SELECT 'VEL', 'VEL' FROM DUAL UNION ALL
SELECT 'VEL', 'XXX08' FROM DUAL )
SELECT x, y
FROM   (SELECT x, y, row_number() over (partition by least(x,y), greatest(x,y) order by rownum) rn
        FROM   t)
WHERE  rn = 1
HOUSE,HOUSE
HOUSE,JME0609U
HOUSE,JME4Q08
HOUSE,JMEM
HOUSE,MATCH2
HOUSE,MATCH3
HOUSE,PGCM
HOUSE,PGCU
HOUSE,VEL
HOUSE,XXX08
JME0609U,JME0609U
JME0609U,MATCH3
JME0609U,PGCM
JME0609U,PGCU
JME0609U,VEL
JME0609U,XXX08
JMEM,JMEM
JMEM,MATCH3
JMEM,PGCM
JMEM,PGCU
JMEM,VEL
JMEM,XXX08
MATCH2,MATCH2
MATCH2,MATCH3
MATCH2,PGCM
MATCH2,PGCU
MATCH2,VEL
MATCH2,XXX08
MATCH3,MATCH3
MATCH3,XXX08
PGCM,PGCM
PGCM,XXX08
PGCU,PGCU
PGCU,XXX08
VEL,VEL
VEL,XXX08

Similar Messages

  • Help with removing person in photo

    I'm fairly new to photoshop and am familiar with removing objects/content aware.In the link im trying to remove the person with the hat on and fix whats left over to make it look like water is there.Mostly though having trouble removing the lower part of the guy between his arms and keeping the water and plants there.
    http://i.imgur.com/Ol4NQ2J.jpg
    So my question would be what is the cleanest/pro way of removing the person and keeping it looking like the water and weeds are still there?thanks for the help.

    thank you Cadogan, I am glad you like the results. Here are a few images that might help:
    this was the plane I made inside vanishing point, the idea is to ignore everything else and just try to focus at the river perspective. If your plane turns red or yellow you have an invalid plane that vanishing point can't really understand. play around with settings until you get a blue plane. once the plane looks good, hit ok to exit vanishing point.
    create a new layer and go back to vanishing point, clone stamp some water from the top right area, until you get something like this:
    as you can see I am overlapping his arms a lot, and cleaning up unwanted parts later by loading up the mask. play around with Levels to lighten up the water a bit and it should blend pretty well.
    finally, add a new layer to clone stamp the weeds, these were the general areas I used:
    please post again if you have any question, have fun!

  • Help with removing my account name from the search...

    Dear Sirs:
    Due to a breach security in my P.I., I need to have my skype name to be removed from the search directory.  Please help me.
    Thanks,
    GP

    Hi, GP2013, and welcome to the Community,
    Please take a look at this information: 'Can I delete my Skype account?' and then contact customer service for assistance.  We here in the Community do not have access to Skype account details.
    Here is a slightly annotated version of the instruction to file your request with Skype Customer Service, and to receive a reply via e-mail.  Hope this serves as a useful road map!
    Regards,
     Elaine
    How can I contact Skype Customer Service?
    Skype offers help and support through:
    The Skype Support website
    The Skype Community
    The Heartbeat blog
    Skype blogs
    Email and Live chat (for eligible customers)
    To get help with the issue you’re experiencing:
    Go to the Support request page.  You will be asked to sign on to the Skype website at this step.
    Select the topic you need help with and the problem you’re experiencing. ... or the closest topic which matches your enquiry.  Some information that might help with your problem is displayed.  These are the FAQ articles pulled from the library for your review.
    If you still feel that the information doesn’t help, scroll down to the bottom of the website page and click the Continue support request button at the bottom of the screen. 
    Select your contact method. (We recommend that you check our Skype Community first. No need to circle back here, as the Community is where you started!)
    If you chose email, enter your details, describe your problem, and then click Send support request. We'll get back to you as soon as we can.
    We don’t currently provide telephone support.
    Was your question answered? Please click on the Accept as a Solution link so everyone can quickly find what works! Like a post or want to say, "Thank You" - ?? Click on the Kudos button!
    Trustworthy information: Brian Krebs: 3 Basic Rules for Online Safety and Consumer Reports: Guide to Internet Security Online Safety Tip: Change your passwords often!

  • Help with removing minor animation?

    hello can smeone please help me remove this minr animation from this flash file. the animation i would like to remove is the one dat appears in the start and gives it the effec of moving the menu from left to rite. i have gone thoguh the all the movie clips and cant figure it out. im new with flash. fyi, i got this template from a site. i was able to remove lots of stuff but i cant get ridof the effect from left to right. if someoen can help me it will be greatly appreciated. also if u can explain it will be great. i wanna learn flash

    how do i add the file? grrrrrrrrr i need some help.

  • Help with removing/deleting medical collection!

    Hello!! I am new to this forum and I am so glad that I found it. The wealth of information shared on this site is remarkable. Thank You All!!! I am looking for guidance with removing/deleting a medical collection from my CR. I researched the HIPPA process and guidelines (which I know cannot be discussed on this site) but I have not heard back from the creator. My question is has anyone had success with removing a medical collection without using the HIPPA process? If so, can you please share your strategy with me? The CA is Sav-it Enterprises in NJ and the amount owed is $300 from 2011 and I am willing to pay in full, today, in order to get it deleted. I sent them a pay for delete letter and they sent me the statement from the doctor's office and updated the account with the CRA. However, I did notice that the date of first delinquency is incorrect, if that even matters. I don’t know what I should do now or how I should move forward with getting it deleted. Any information you can share with me will be extremely helpful. This is the only remaining collection account that I have and I need it removed in order to increase my scores to qualify for a mortgage. Thanks in advance.

    Yes, I do have proof that they date is incorrect - its off by 1 year. Also, the billing statement they sent me shows the date as 2011 but they are reporting it as 2012. I also have explanation of benefits from my insurance provider which confirms that date as 2011. Okay. I will call them today to offer full payment and then send a GW letter shortly after paying. I really hope it works because I really need to get this removed. 

  • Pages help with removing "facing pages" margins

    howdy!
    having trouble with removing the "facing pages" function. read the post on 1-up vs 2-up and i selected 1-up and unclicked "facing pages" but my margins still show the large gray area to left and right respectively. i would like to re-set to normal 1 inch margins all around but system doesnt seem to revert back to this function. please help - i dont want to recreate this entire document!
    gracias
    powerbookg4   Mac OS X (10.4.8)  

    Welcome to Apple Discussions
    I would think what you tried would have fixed it, so there has to be something elsewhere. Did you check the margins in the layout inspector?

  • Help with Apache Reverse Proxy configuration with SAP Portal and SAP Webgui

    Dear Experts,
    I have an issue configuring Apache to work with SAP Portal and ERP webgui. Accessing Portal through Reverse Proxy is working fine. But the problem arises when we try to open an iView ERP webgui transaction page from Portal with the Reverse Proxy. Have anyone implemented similar requirements and could advice on the configuration required on the Apache side? Thank you

    hi,
    pls check the below links for reference:
    https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/24396589-0a01-0010-3c8c-ab2e3acf6fe2
    searchsap.techtarget.com/searchSAP/downloads/chapter-december.pdf
    1)Learn to implement the reverse proxy filter and portal gateway in SAP Enterprise Portal 6.0 on Web Application Server 6.40.
    https:/.../irj/sdn/nw-portalandcollaboration?rid=/webcontent/uuid/006efe7b-1b73-2910-c4ae-f45aa408da5b
    .2 )Configuring the Portal for Your Reverse Proxy Filter Solution . ... This document describes the reverse proxy filter mechanism in SAP Enterprise ...
    https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/32ad9b90-0201-0010-3c8a-c900cd685f8f
    3)have full reverse proxy functionality. Possibly. filter. requests. Internet ... Reverse proxy (optionally with authentication etc.) ...
    https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/c066c390-0201-0010-3cba-cd42dfbcc8be
    Note:please reward points if solution found helpfull
    Regards
    Chandrakanth.k

  • Remove the duplicate rows but keep the most recent and oldest records

    I have a Product table, some products have duplicate rows(same productID). I want to keep the most recent and the oldest records based on ETL load date (or min and max productKey), delete others. How to do this in a simple way?
    ProductKey | ProductID |ETL_Load_Date
    1001 | 501 | 2014-01-01
    1002 | 501 | 2014-01-02
    1003 | 501 | 2014-01-03
    1011 | 502 | 2014-01-01
    1012 | 502 | 2014-01-02
    1013 | 502 | 2014-01-03

    declare @table table (ProductKey int, ProductID int, ETL_Load_Date date)
    insert @table (ProductKey, ProductID, ETL_Load_Date)
    values
    ( 1001 , 501 , '2014-01-01' ), ( 1002 , 501 , '2014-01-02' ),
    ( 1003 , 501 , '2014-01-03' ), ( 1011 , 502 , '2014-01-01' ),
    ( 1012 , 502 , '2014-01-02' ), ( 1013 , 502 , '2014-01-03' )
    SELECT *
    FROM @table t
    INNER JOIN (
    SELECT MIN(etl_load_date) min_load_date, MAX(etl_load_date) max_load_date, ProductID
    FROM @table
    GROUP BY ProductID
    ) m
    ON t.ProductID = m.ProductID
    AND t.ETL_Load_Date IN (min_load_date,max_load_date)
    This will show both the min and max load dates, for each ProductID
    Thanks to Saeid for posting some test objects.

  • Help with remove.Instance function removing the wrong row

    Hi there,
    I have been working on Livecycle forms for about two weeks now and have been able to work out quite a bit of what I need to do.  However, I am really hoping someone can help me with a two problems that I cannot seem to solve. 
    The first one is; if I click on the 'remove a row' function on my form and it is the only row, it comes up with an error message,  How do I stop that from being displayed?  I think I need to use the IF function with >1 but cannot seem to get it to work.
    Secondly, if for example I add two rows using the +row button to make three rows and in rows 1&2 I input some data.  If I then want to delete row 3 and press the -Row button it deletes row number 2 and the data in that row and leaves row number 3.  How can I change it so that when I delete a row it deletes row number three and leaves row number 2.  essentially, I need it to delete rows from the bottom up and not from the top down.  Hope this makes sense.  Any help would be greatly appreciated!
    Attached is a link to my form.
    https://copy.com/RiktBtj0uiSA
    Thank you.

    Hi there,
    When removing instances within an object's event which is inside the instance, you must make sure that you remove this particular instance at the end of the event.
    E.g.:
    If you remove the instance of which the button is inside before even finishing the whole event, the program will not recognize what event is to be finished because you have removed the object's which is fired..
    So here you are trying to finish some code which doesn't exist anymore ...
    I suggest you should always remove the instance of (this) object at the end of any event to make sure to finish all your actions before deleting the object.
    Hope this help!

  • Help with removing text from background

    Hi,
    I'm pretty new to this, but I'm trying to figure out how to remove text from a background.  My problem is that when I use tools to grab the text, it only selects part of it because the pixels of the text are actually different colors as it blends in with the backgorund.  Does anyone have a quick idea how to do this?
    Thanks
    <link removed>

    Don't you like to see people's websites/projects/works in forums?  Seems to me that you get to know people and what they are into when they post their work.  Anyways in the spirit of you helping me, here is the picture.
    I'm trying to remove the letters from the background.  Everything about the letters including the shadows.
    Thanks

  • Help with removing unavailable secondary site

    I created a SCCM 2012 SP1 CU4 secondary site and remove it also.
    Now my primary server eventlog is full with messages like: (about 10 each
    The activated proc '[dbo].[spRCMActivation]' running on queue 'CM_PRI.dbo.ConfigMgrRCMQueue' output the following: 'ERROR Sending SSB Message from: ConfigMgrRCM_SitePRI to ConfigMgrRCM_SiteSEC SQL Error: 50000 SQL Message: ERROR 50000, Level 16, State 1, Procedure spGetSSBDialogHandle, Line 58, Message: Route is not defined for target site with service name ConfigMgrRCM_SiteSEC.'
    I found out then in SQL Management Console CM_PRI\Service Broker\Queues\dbo.ConfigMgrRCMQueue was disabled.
    When enabling, it will be disabled again....what I also saw is that in the queue (select * FROM [CM_PRI].[dbo].[ConfigMgrRCMQueue]) messages are related to the secondary which is not available anymore. How do I get rid of those queued messages ?
    Due to this bahaviour my other secondaries links are down now :-(
    Please help, how can i solve this quick ?

    I uninstalled the site from the console which worked fine. Preinst /delsite SEC also tells me site is removed. However my application event log on the primary is full of errors. When investigating this I saw an entry in the SQL queue which cause this I
    think. So how can I remove this entry from the ConfigMgrRCMQueue queue in SQL. Now this queue is disabled ! Which caused my links to be down to all other secondaries.

  • Help with removing unwanted songs......

    From what I've understood on other discussion boards, if the little check isn't marked next to a song in your iTunes library, it won't be updated to your iPod. But that doesn't seem to be true for my iPod. It seems like no matter what songs I un-check in hopes of never hearing on my iPod they always end up in my playlist.
    I'm sharing my iTunes with my aunt, who has a new shuffle (I just got an 80g) so she ended up with all my songs, and I have all my songs, AND her songs. We have very different tastes in music, so we're both curious as to how to change the playlists on our new toys.
    Is there any other way to remove songs from your iPod? (i chose to manually manage music/videos, but they're still on my pod.....)
    Any help is greatly appriciated!!!

    The updating checked items option doesn't work if you have the iPod set to manual.
    See here for how to load songs onto a shuffle.
    http://docs.info.apple.com/article.html?path=iTunesWin/7.0/en/799.html
    Seems like you need to create playlists for your Aunt's music and load only those to the shuffle.
    For your iPod, if you have the iPod set to manually manage your songs, and you want to delete the song from the iPod only, then select the iPod in the source list of iTunes, or click on the "music" option underneath it to show all your songs. Highlight the song(s) you no longer want on the iPod, right click and select "clear", or use the edit/delete menu in iTunes.
    This method only deletes the songs from the iPod, so if you no longer want the song in iTunes also, you'll need to delete it from there separately using the method above.

  • Help with removing sweat stains

    Hey,
    Was wondering if anyone would be able to edit a photo of my friend and I who has recently graduated from high school. I have tried absolutely everyone yet I am still unable to remove the sweat stains located under my shirt. If anyone could help me with this it would mean a lot!

    One stroke of Spot Healing Brush Tool (J) over the stain area gave the following result.

  • Need help with a reverse number method

    hey all..
    i have this program which should return the integer reversed ..
    i have done this program using methods.. but the problem is if the
    number endes with 0 when it reversed the output doesn't contain the number 0
    for example:
    input
    123450
    output
    54321
    where before the 5 there should be 0
        This program that reads an integer and then calls a method
          that receives an integer and returns the integer with its digits reversed.
          Main prints the resulting integer.
       import java.util.Scanner; // program uses class Scanner
        class Sh9q4
           // main method begins execution of Java application
           public static void main( String args[] )
          // create Scanner to obtain input from command window
             Scanner input = new Scanner( System.in );
             int number; // The number entered by the user
             System.out.println("Enter an integer"); // prompt for input
             number = input.nextInt(); // read the the integer
             reverse (number); // print the method reverse
          } // end method main
           public static void reverse ( int num )
             int lastDigit; // the last digit returned when reversed
             int reverse = 0;
             do
                lastDigit = num % 10;
                reverse = (reverse * 10) + lastDigit;
                num = num / 10;
             while (num > 0);
             System.out.println("The integer with its digits reversed " + reverse); // print the integer reversed
          }// end method reverse
       } // end class Sh9q4thanks for your help :)

    If you need the leading zero to display, then you will have to do as Keith recommended and convert the input number to a String, then reverse that String and print it as a String.
    A number is a number is a numerical value, and there is no difference between the value of 054321 and 54321 except when written as a literal, when the first is an octal, and the second a decimal, value.
    If you are still confused, plug in these few lines of code and run them:String str = "012345";
    int x = Integer.parseInt (str);
    System.out.println(str);
    System.out.println(x);db

  • Help with Library Management - duplicate files, single develop settings.

    I use Lightroom 5 and local disk as my supposed master.
    I use GoodSync and an external drive as my backup.
    When I am traveling I use my Macbook and the external drive - and this has caused the following problem;
    Instead of just being a backup, my external drive is now a folder in Lightroom.
    The develop settings are associated with the files on that drive and I have duplicates through the synchronisation process that I run with Goodsync.
    Can I move the develop settings (All, Automagically) back to the files located on my local drive and remove the folder from Lightroom?
    I will manage my backup process differently.
    Or .. do I create a new catalog and import the files from ... the external drive first? Or the local?
    Possibly external to ensure I don't lose any settings?
    Any advice, especially if someone else has found themselves in this predicament, would be greatly appreciated!
    Thank you

    When using a Finder specifier you also need to include the startup disk.  There are a few different domains that the path to command will work with.  If you don't specify a domain, such as your first example, the assumption is that you want the user domain.  The /Library/Preferences folder is in the local domain so you can use the following command to get its path:
        path to preferences folder from local domain

Maybe you are looking for

  • Table Maintenance - Add field not in table for display

    I have a Z table which has five fields of which one of them is the GL account field. I need to display the description of the account from SKAT-TXT20 also in SM30 so that In SM30 when the user looks at the table, they should be able to see six fields

  • Sluggish performance and slow visio image loading in Acrobat Reader

    I have created a pdf file with the Adobe PDF-"printer" from an original Word document. The Word document contains image components from Visio, which have been copy-pasted into the Word document (for instance a UML diagram). While the performance in W

  • Idoc to SOAP Async - Sync - stuck @ bpm bridge

    Hi there, i'm implementing an SAP - Idoc / Async ---> PI - > Soap / Sync communication, the idea is that i update the Idoc Status back on erp using and status idoc, i got the whole scenenario working but the Async - Sync bridge part with the status i

  • Reg : BAM connection

    Hi Experts , I am new to BAM Reports. I installed SOA server along with that i got BAM too. I up both the servers SOA & BAM. Now from my J Developer i want to create a BAM connection. But when i am clicking on Connections in application Resources and

  • Creating a JTable with resizeable columns and Horizontal Scrollbar

    Hi, I would like to create a JTable with about 24 columns in it. The problem is, my ViewPort in my JScrollPane is about 3-400pixels wide, and the JTable tries to cram itself into the ViewPort. This makes the columns too tiny to read. I'd like it to d