Results 1 to 4 of 4

Thread: How to get result from Query by group of (n) rows like LIMIT in MYSql

  1. #1
    Alex Guest

    How to get result from Query by group of (n) rows like LIMIT in MYSql

    How to get result from Query by group of (n) rows ?

    - Is cursors the better way (and the only) ?

    -Is there something as ROWNUM in Oracle or LIMIT in MySql ?

    Example plz !

    Thanks.

    Alex

  2. #2
    Duncan Maddox Guest

    How to get result from Query by group of (n) rows like LIMIT in MYSql (reply)


    SELECT TOP 5 * FROM [table]

    Gives the first 5 records.

    Duncan

    ------------
    Alex at 9/23/99 3:55:41 AM

    How to get result from Query by group of (n) rows ?

    - Is cursors the better way (and the only) ?

    -Is there something as ROWNUM in Oracle or LIMIT in MySql ?

    Example plz !

    Thanks.

    Alex

  3. #3
    nestor Guest

    How to get result from Query by group of (n) rows like LIMIT in MYSql (reply)

    i know for top and top with ties

    i want to get the 5 (example) first rows and after the 6rd to 10rd rows and after the 11rd to 15rd and..... OK !

    with TOP n or SET ROWCOUNT n you can only get the first to (n)rd rows.

    Thanks


    ------------
    Alex at 9/23/99 3:55:41 AM

    How to get result from Query by group of (n) rows ?

    - Is cursors the better way (and the only) ?

    -Is there something as ROWNUM in Oracle or LIMIT in MySql ?

    Example plz !

    Thanks.

    Alex

  4. #4
    Brian K Guest

    How to get result from Query by group of (n) rows like LIMIT in MYSql (reply)


    Here is how to do it:

    copy the file you need to look at into a temp file (#t)

    while exists (select * from #t)
    begin
    set rowcount 5
    select * from #t
    delete #t -- This would delete the same five so you don't get them again
    set rowcount 0
    end

    The lop makes sure you get out when they are all done. You can modify this to
    exit the loop based on other requirements as well.
    ------------
    nestor at 9/23/99 10:35:50 AM

    i know for top and top with ties

    i want to get the 5 (example) first rows and after the 6rd to 10rd rows and after the 11rd to 15rd and..... OK !

    with TOP n or SET ROWCOUNT n you can only get the first to (n)rd rows.

    Thanks


    ------------
    Alex at 9/23/99 3:55:41 AM

    How to get result from Query by group of (n) rows ?

    - Is cursors the better way (and the only) ?

    -Is there something as ROWNUM in Oracle or LIMIT in MySql ?

    Example plz !

    Thanks.

    Alex

Posting Permissions

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