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. #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. #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. #4
    Super Moderator guelphdad's Avatar
    Join Date
    Mar 2006
    Location
    St. Catharines, Ontario Canada
    Posts
    2,665
    Thanks
    6
    Thanked 150 Times in 141 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. #5
    Supreme Master coder! Old Pedant's Avatar
    Join Date
    Feb 2009
    Posts
    29,698
    Thanks
    93
    Thanked 4,947 Times in 4,908 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.
    Be yourself. No one else is as qualified.


 

Posting Permissions

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