Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 5 of 5
  1. #1
    Banned
    Join Date
    Mar 2007
    Posts
    1,523
    Thanks
    116
    Thanked 0 Times in 0 Posts

    Question ACCESS: Select Top 4

    in my code below, how would i just select the TOP 4?

    Code:
    "SELECT tblPageContent.*, tblPageContentGroups.* FROM tblPageContent INNER JOIN tblPageContentGroups ON tblPageContent.ID = tblPageContentGroups.pageID WHERE tblPageContentGroups.groupID = 29"

  • #2
    New Coder
    Join Date
    Mar 2009
    Posts
    90
    Thanks
    5
    Thanked 14 Times in 14 Posts
    Hi, you've to append ORDER BY desired_field_name DESC LIMIT 4

  • #3
    Banned
    Join Date
    Mar 2007
    Posts
    1,523
    Thanks
    116
    Thanked 0 Times in 0 Posts

    Exclamation

    LIMIT does not work in ACESS

  • #4
    Super Moderator guelphdad's Avatar
    Join Date
    Mar 2006
    Location
    St. Catharines, Ontario Canada
    Posts
    2,633
    Thanks
    4
    Thanked 148 Times in 139 Posts
    Well you are posting in a MySQL forum so you are asking about the wrong database by posting here.

    i'll move your question to the General Database questions area.

  • #5
    Supreme Master coder! Old Pedant's Avatar
    Join Date
    Feb 2009
    Posts
    25,184
    Thanks
    75
    Thanked 4,340 Times in 4,306 Posts
    With most DBs--including Access--you just do:
    Code:
    SELECT TOP 4 ..... ORDER BY xxxx
    You don't have to use ORDER BY, but the results will be meaninglessly random if you don't.
    An optimist sees the glass as half full.
    A pessimist sees the glass as half empty.
    A realist drinks it no matter how much there is.


  •  

    Posting Permissions

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