Results 1 to 6 of 6
  1. #1
    djclntn is offline Competent Performer
    Windows 7 32bit Access 2010 32bit
    Join Date
    Feb 2011
    Posts
    476

    A Query that counts the # of Records according to the first letter?

    Can anyone kindly tell me how to create a query that will tell me how many ‘Cities (Records) I have in my Table with the first letter starting with, “A,” “B,” “C,” etc.?

    Query will look something like:
    A 10
    B 15
    C 20



    Thanks!

  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,652
    SELECT Left(FieldName, 1) AS FirstLetter, Count(*) AS HowMany
    FROM TableName
    GROUP BY Left(FieldName, 1)
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  3. #3
    djclntn is offline Competent Performer
    Windows 7 32bit Access 2010 32bit
    Join Date
    Feb 2011
    Posts
    476
    Table Name Is: 'Territory Codes'
    Field Name is "trrtyCd"

    I tried this in SQL, doesn.'t work:

    SELECT Left(TrrtyCd, 1) AS FirstLetter, Count(*) AS HowMany FROM Territory Codes GROUP BY Left(TrrtyCd, 1)

  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,652
    Because of the inadvisable space, you need to bracket the table name.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  5. #5
    djclntn is offline Competent Performer
    Windows 7 32bit Access 2010 32bit
    Join Date
    Feb 2011
    Posts
    476
    Thanks Paul!

  6. #6
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,652
    No problemo!
    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. Replies: 4
    Last Post: 09-18-2012, 05:07 AM
  2. Query Not Returning Zero Counts
    By TimMoffy in forum Queries
    Replies: 3
    Last Post: 07-05-2012, 10:08 PM
  3. Issue with Counts of Checkboxes in Query
    By JamiB1979 in forum Queries
    Replies: 3
    Last Post: 06-29-2011, 02:41 AM
  4. Reporting counts in another query...maybe?
    By Geewaagh in forum Queries
    Replies: 7
    Last Post: 06-04-2010, 07:39 PM
  5. Missing Counts that = 0 in query results
    By dandhjohn in forum Queries
    Replies: 1
    Last Post: 01-29-2010, 11:28 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