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

Thread: How to get the result from the top [ URGENT PLEASE PLEASE HELP ]

  1. #1
    Join Date
    Mar 2001
    Posts
    19
    Team,

    Please help me to figure this out.

    When i do the following query

    Query
    =========
    SELECT title
    FROM ent_bulletin_messages
    WHERE rowid in (
    SELECT rowid FROM ent_bulletin_messages
    WHERE rownum <= 3
    MINUS
    SELECT rowid FROM ent_bulletin_messages
    WHERE rownum < 0)order by parentID, messageID

    Output
    =======
    first title
    second title
    third title


    But when i do the same query with a value less

    Modified Query
    ==========
    SELECT title
    FROM ent_bulletin_messages
    WHERE rowid in (
    SELECT rowid FROM ent_bulletin_messages
    WHERE rownum <= 2
    MINUS
    SELECT rowid FROM ent_bulletin_messages
    WHERE rownum < 0)order by parentID, messageID

    Modified Output
    ===========
    second title
    third title

    But i want the output to belike this

    Desired Output
    ===========
    second title
    third title

    Why is that is taking the output from the last and then displaying them how shall i achieve the output as desired above??.

    Cany anyone please please help me


    Thanks a million for allyour help,
    Seenu

  2. #2
    Join Date
    Mar 2001
    Posts
    19

    SORRY TYPO PLEASE CONSIDER THIS AS DESIRED OUTPUT

    But i want the output to belike this

    Desired Output
    ===========
    first title
    second title

    SORRY ALL, I WANT THE DESIRED OUTPUT TO BE LIKE THE ONE ABOVE BUT NOT AS MENTIONED IN MY EARLIER EMAIL.

    Apologies for any incovenience cause,

    Expecting all your help,
    Seenu

  3. #3
    Join Date
    Nov 2000
    Posts
    344
    Try this :

    SELECT title
    FROM ent_bulletin_messages
    WHERE rowid in (
    SELECT rowid FROM ent_bulletin_messages
    WHERE rownum <= 3
    MINUS
    SELECT rowid FROM ent_bulletin_messages
    WHERE rownum =1)
    order by parentID, messageID

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