Results 1 to 4 of 4
  1. #1
    Join Date
    Feb 2004
    Posts
    41

    Unanswered: Access db Syntax Error

    What's wrong with this query?

    SELECT *
    FROM plant_list
    ORDER BY [plant_id]
    LIMIT 3;


    It returns the error:

    Systax error (missing operator) in the query expression '[plant_id]
    LIMIT 10'

    What operator is missing? Please help, thanks.

  2. #2
    Join Date
    Apr 2002
    Location
    Toronto, Canada
    Posts
    20,002
    what's wrong with the query? it's mysql syntax, that's what

    for access, try this:

    Code:
    select top 3 * from plant_list order by plant_id
    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL

  3. #3
    Join Date
    Feb 2004
    Posts
    41
    Outstanding... It worked.

    But what if I what to "page" thru the data? Can I specify a starting row?

    Thanks for your help!

  4. #4
    Join Date
    Apr 2002
    Location
    Toronto, Canada
    Posts
    20,002
    not easily, no

    first of all , you need to have a column or columns to order by

    to get rows 11-20 in sql server,
    Code:
    select *
    from ( 
    select top 10 * 
    from ( 
    select top 20
    from plant_list 
    order by plant_id asc ) xx
    order by plant_id desc ) yy        
    order by plant_id asc )
    in access, i think you have to write actual queries for the inner subselects
    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL

Posting Permissions

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