Stories
Slash Boxes
Comments
NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.

All the Perl that's Practical to Extract and Report

The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
 Full
 Abbreviated
 Hidden
More | Login | Reply
Loading... please wait.
  • Rownum? (Score:2, Informative)

    SELECT * FROM myTable WHERE ROWNUM < 50;

    Isn't that equivalent?

    /claes

    • Yes, but what do you do for page two, when you want 50 < ROWNUM < 100?

      <g>

      --
      J. David works really hard, has a passion for writing good software, and knows many of the world's best Perl programmers
      • select
           rownum myrownum
           ,stuff
        from
           mytable
        where
           myrownum>50
           and myrownum<50
        • That's great, but it doesn't work.

          --
          J. David works really hard, has a passion for writing good software, and knows many of the world's best Perl programmers
          • select myrownum,stuff from(select (rownum) myrownum,stuff from mytable) where myrownum>50 and myrownum100 you're right, but this does.. not sure why it doesn't allow you to alias the rownum in the outer query
            • the only reason I think the rownum concept has merit, is if you want to have a query on a table that is ordered by something other than the primary key - and you want to find a particular value, and view the rows around it.

              if there is an easy way to do that using limits and offsets let me know.. I'm trying to make a dictionary page that finds a word and prints nearby words (in mysql) - while reading up on it I found the oracle rownum stuff and decided it would be easier with that.

              I guess I could do a