Results 1 to 4 of 4
  1. #1
    nols76 is offline Novice
    Windows XP Access 2007
    Join Date
    Aug 2011
    Posts
    2

    Select, Count, Where (Like) HELP!

    Hello all,
    Having a tough time figuguring this one out. I have thousands of primary key reference numbers in a table such as:



    2011015003001140
    2011015003001150
    2011015003003480
    2011055065006480
    2011065065006480
    2011065065006490

    I tried to run a query that counts the records that have a '65' in the 9th and 10th digits ONLY. No luck with the below. Can someone please help?

    Code:
     
    SELECT Count([Messages Sent].[Reference Number]) AS [CountOfReference Number]
    FROM [Messages Sent]
    WHERE ((([Messages Sent].[Reference Number]) Like "????????65??????"));

  2. #2
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    I would probably use the Mid() function, like:

    WHERE Mid(...) = 65

    More info on the Mid() function in Help.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  3. #3
    nols76 is offline Novice
    Windows XP Access 2007
    Join Date
    Aug 2011
    Posts
    2
    many thanks

  4. #4
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    No problem, and welcome to the site by the way.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Count is off when using =Count
    By boywonder in forum Programming
    Replies: 3
    Last Post: 06-09-2011, 12:14 PM
  2. Replies: 8
    Last Post: 04-21-2011, 05:29 PM
  3. count and switch function in same select query
    By sandlucky in forum Queries
    Replies: 2
    Last Post: 04-08-2011, 11:16 PM
  4. Replies: 4
    Last Post: 03-17-2011, 06:17 AM
  5. Replies: 1
    Last Post: 10-22-2010, 10:11 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums