Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8626493
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T08:02:42+00:00 2026-06-12T08:02:42+00:00

I have the query below; Select count(*) as poor from records where deviceId=’00019′ and

  • 0

I have the query below;

Select count(*) as poor
from records where deviceId='00019' and type='Poor' and timestamp between #14-Sep-2012 01:01:01# and #24-Sep-2012 01:01:01#

table is like;
id. deviceId, type, timestamp

data is like;

data is like;

1, '00019', 'Poor', '19-Sep-2012 01:01:01'
2, '00019', 'Poor', '19-Sep-2012 01:01:01'
3, '00019', 'Poor', '19-Sep-2012 01:01:01'
4, '00019', 'Poor', '19-Sep-2012 01:01:01'

i am trying to count the devices with a specific specific type.

Please help.. access always returns wrong data. it is returning 1 while 00019 has 4 entries for poor

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-12T08:02:43+00:00Added an answer on June 12, 2026 at 8:02 am

    Type and timestamp are both reserved words, so enclose them in square brackets in your query like this: [type] and [timestamp]. I doubt those reserved words are the cause of your problem, but it’s hard to predict exactly when reserved words will cause query problems, so just rule out this possibility by using the square brackets.

    Beyond that, stored text values sometimes contained extra non-visible characters. Check the lengths of the stored text values to see whether any are longer than expected.

    SELECT
        Len(deviceId) AS LenOfDeviceId,
        Len([type]) AS LenOfType,
        Len([timestamp]) AS LenOfTimestamp
    FROM records;
    

    In comments you mentioned spaces (ASCII value 32) in your stored values. I had been thinking we were dealing with other non-printable/invisible characters. If you have one or more actual space characters at the beginning and/or end of a stored deviceId value, the Trim() function will discard them. So this query will give you different length numbers in the two columns:

    SELECT
        Len(deviceId) AS LenOfDeviceId,
        Len(Trim(deviceId)) AS LenOfDeviceId_NoSpaces
    FROM records;
    

    If the stored values can also include spaces within the string (not just at the beginning and/or end), Trim() will not remove those. In that case, you could use the Replace() function to discard all the spaces. Note however a query which uses Replace() must be run from inside an Access application session — you can’t use it from Java code.

    SELECT
        Len(deviceId) AS LenOfDeviceId,
        Len(Replace(deviceId, ' ', '')) AS LenOfDeviceId_NoSpaces
    FROM records;
    

    If that query returns the same length numbers in both columns, then we are not dealing with actual space characters (ASCII value 32) … but some other type of character(s) which look “space-like”.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have this query below: Select count(CDT) as Actions From Player_Tapjoy Where Trunc(CDT) >=
I have a below query: select count(*) c , id from hr where time
I have written this query for retrieving data from mysql as below select FeedbackCode,EMailID,FeedbackDetail,
I have the below query in a postgresql database SELECT * FROM accounts where
I have a query like below to select 'sid' with highest count and its
So I have a query where I select from the 'sites' table, and count
I have a query that spits out a result: Select Sum(Count(P.Create_Dtime)), From Player P
I have the below query: --Total DLs-- select sum(DLs) as DLs_Total From ( Select
Heya!, I have the below query: SELECT t1.pm_id FROM fb_user_pms AS t1, fb_user_pm_replies AS
I have the following query Select count(*) as TotalCount from ABC where ID in

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.