Results 1 to 4 of 4
  1. #1
    Join Date
    Aug 2003
    cape town; south africa

    Question Unanswered: Limiting record sections ie. 50 to 100

    Hi there, really strugling with this any advice would be great - thanx

    I need to pull back records according to a limit like, out of the records i pull back i only want records 50 to 100 etc. from all the ones i pull back, the records coming back can be completely out of order, non-sequential Id's so cant rely on that. I know MySQL has a command that can do it...

    Select * from table where attrib = 20 limit 50,100 order by attrib

    please if you know of a command or some query trick that can do it I NEED HELP!!


  2. #2
    Join Date
    Jul 2003
    Kaukapakapa, NZ

    SELECT TOP 25 field_name
    FROM Table_name;

  3. #3
    Join Date
    Aug 2003
    cape town; south africa
    thanx but i need specificaly between two pieces of the query result not just from the top, i think ive found this code that will work though, this is for sql server but im modifying it to work in Access seems to be working so far

    declare @pagenum as int
    declare @pagesize as int
    declare @records as int
    declare @string as varchar(500)

    select @pagenum = 1
    select @pagesize = 20
    select @records = @pagenum * @pagesize

    SELECT @string = 'SELECT TOP ' + CONVERT(nvarchar(5), @pagesize) + '*
    FROM (SELECT TOP ' + CONVERT(nvarchar(5), @pagesize) + ' *
    FROM (SELECT TOP ' + CONVERT(nvarchar(5), @records) + ' productid, productname
    FROM products
    ORDER BY productid ) products ORDER BY productid DESC) products ORDER BY productid'

    exec( @string )

  4. #4
    Join Date
    Oct 2002
    Leicester - UK
    i'm not sure if this is what your after (or even if it works) but you can do

    where [datefield] between date1 and date2

    this may cross over to other data types or not but atm it's the best i can offer
    Definition of a Beginner, Someone who doesn't know the rules.

    Definition of an Expert, Someone who knows when to ignore the rules.

Posting Permissions

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