DBAsupport.com Forums - Powered by vBulletin
Results 1 to 3 of 3

Thread: A Select needed

  1. #1
    Join Date
    May 2001
    Location
    Atlanta US
    Posts
    262
    Hi Gurus!
    I have a table with 2 cols colA and colB.

    The data is as follows:

    colA colB
    john smith
    smith john

    I wish to select only one of these rows, or I wish to even delete one of these rows.
    How would I do it?

    Thanks!


    Hemant

  2. #2
    Join Date
    Sep 2001
    Location
    NJ, USA
    Posts
    1,287
    your delete statment should be like this:

    ------------------------------------------------------
    delete from your_table t1
    where rowid < (select max(rowid) from your_table t2
    where
    t1.colA || ' ' ||t1.colB = t2.colA || ' ' ||t2.colB
    or
    t1.colA || ' ' ||t1.colB = t2.colB || ' ' ||t2.colA)
    ;
    ------------------------------------------------------

  3. #3
    Join Date
    May 2001
    Location
    Atlanta US
    Posts
    262
    Thanks a deal Shestakov!
    Hemant

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Click Here to Expand Forum to Full Width