SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    SitePoint Enthusiast athena's Avatar
    Join Date
    Apr 2002
    Location
    Vancouver, Canada
    Posts
    91
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Question LIMIT using MS Jet SQL for Access 2000

    I'm familiar with how you do most database stuff within MySQL, however I'm running into some problems as I try to take that SQL knowledge over to MS Jet SQL for Access 2000.

    If I were to write the query under MySQL it would be
    "SELECT * FROM `Anim` LIMIT 0, 30"

    But if I were to send that query to an Access database, I get an error. Does Jet SQL not have a Limit command? If not, is there some other way to get the same functionality?


    thanks.

  2. #2
    SQL Consultant gold trophysilver trophybronze trophy
    r937's Avatar
    Join Date
    Jul 2002
    Location
    Toronto, Canada
    Posts
    39,322
    Mentioned
    63 Post(s)
    Tagged
    3 Thread(s)
    that's right, jet sql is not the same as mysql sql

    surprised?
    Code:
    select top 30 * from [Anim] order by foo
    note that neither LIMIT nor TOP makes sense without an ORDER BY, since the order of rows within a table is not defined
    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL
    "giving out my real stuffs"

  3. #3
    SitePoint Enthusiast athena's Avatar
    Join Date
    Apr 2002
    Location
    Vancouver, Canada
    Posts
    91
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by r937
    that's right, jet sql is not the same as mysql sql

    surprised?
    Code:
    select top 30 * from [Anim] order by foo
    note that neither LIMIT nor TOP makes sense without an ORDER BY, since the order of rows within a table is not defined
    Actually I am a little surprised given that I understood that MySQL was just SQL with a bit of handy admin stuff stuck on top... but anyways...

    What about if I want to select 30 records starting at record 60?
    MySQL code: "SELECT * FROM `Anim` LIMIT 60, 30"

  4. #4
    SQL Consultant gold trophysilver trophybronze trophy
    r937's Avatar
    Join Date
    Jul 2002
    Location
    Toronto, Canada
    Posts
    39,322
    Mentioned
    63 Post(s)
    Tagged
    3 Thread(s)
    Quote Originally Posted by athena
    What about if I want to select 30 records starting at record 60?
    MySQL code: "SELECT * FROM `Anim` LIMIT 60, 30"
    that's actually a lot harder than you might think

    see http://www.sitepoint.com/forums/show...58&postcount=6
    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL
    "giving out my real stuffs"


Bookmarks

Posting Permissions

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