Results 1 to 2 of 2
  1. #1
    Join Date
    Jan 2004

    Unanswered: How to maintain the order - performance issue

    Hi ,

    I'm having a table PHONE(ID,PHONE_RANK) where an individual ID can have more than 1 record .

    I've to select the record having the highest PHONE_RANK where the hierarchy (from highest to lowest) is 1,2,3,4,5,6,7,8,12,9,10,11 (i.e. select record where PHONE_RANK = 1 over record where PHONE_RANK = 2).

    The hierarchy order is important , 12 has come before 9 .
    The table contains 80 million data. It's a sample table,it's not the original table.

    I couldn't find out the proper query.

    Please suggest something , Thanks

  2. #2
    Join Date
    Sep 2002
    Provided Answers: 1

    Re: How to maintain the order - performance issue

    Why on Earth does 12 appear there?
    Anyway, you can "fix" that like this:

    CASE WHEN phone_rank BETWEEN 9 AND 11 THEN phone_rank+4
    ELSE phone_rank

    (Or equivalent DECODE if you can't use CASE).

Posting Permissions

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