keyword between

  • I need a sql as "select * from mytable rownum >=10 and rownum <= 20;

    Does ms sql support above sql, if not, how to solve the problem.

    Thanks

  • moongeegee (4/21/2010)


    I need a sql as "select * from mytable rownum >=10 and rownum <= 20;

    Does ms sql support above sql, if not, how to solve the problem.

    Thanks

    select * from mytable where rownum between 10 and 20

    /* ----------------------------- */
    Tochter aus Elysium, Wir betreten feuertrunken, Himmlische, dein Heiligtum!

  • Is rownum a declared column in your table?

  • oops

    If everything seems to be going well, you have obviously overlooked something.

    Ron

    Please help us, help you -before posting a question please read[/url]
    Before posting a performance problem please read[/url]

  • I think the rownum is not the part of the table.

    OP have to clear this. Otherwise the query is very simple.

    ----------------------------------------------------------------------------------------------------------------------------------------------------------------------
    Sometimes, winning is not an issue but trying.
    You can check my BLOG
    [font="Arial Black"]here[/font][/url][/right]

  • select * from mytable where rownum >=10 and rownum <= 20

    The above query is fine only when rownum is a column in your table or you will need to to use the analytical function

    ROW_NUMBER() OVER(order by ) as rownum

    in your select list to get the row number.

    [font="Times New Roman"]Anil Kubireddi[/font]

Viewing 6 posts - 1 through 5 (of 5 total)

You must be logged in to reply to this topic. Login to reply