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 8338659
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T04:39:48+00:00 2026-06-09T04:39:48+00:00

I need to query SQLite datebase table using the following SQL Statement. SELECT *

  • 0

I need to query SQLite datebase table using the following SQL Statement.

SELECT * 
FROM Alarms 
WHERE ALARMSTATE IN (0,1,2) 
  AND ALARMPRIORITY IN (0,1,2,3,4) 
  AND ALARMGROUP IN (0,1,2,3,4,5,6,7) 
  AND DateTime(ALARMTIME) BETWEEN datetime("2012-08-02 00:00:00") 
                    AND datetime("2012-08-03 00:00:00") 
ORDER BY ALARMTIME DESC

ALARMTIME is of TEXT datatype.

ALARMTIME is displayed in the datagridview as follow “08/03/2012 11:52 AM”. Can you use that format for checking like DateTime(ALARMTIME)?

The only problem have with this SQL Statement is that it always returns zero dataset or records. However, SQLite doesn’t complain about the syntax.

  • 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-09T04:39:49+00:00Added an answer on June 9, 2026 at 4:39 am

    Strictly speaking, SQLite doesn’t have datetime types for its columns:

    SQLite does not have a storage class set aside for storing dates
    and/or times. Instead, the built-in Date And Time Functions of SQLite
    are capable of storing dates and times as TEXT, REAL, or INTEGER
    values

    The problem here is that the string you’re using condition isn’t a valid date/time, so it’s treated as null:

    sqlite> SELECT datetime("2012-08-3 00:00:00");
    
    sqlite> SELECT datetime("2012-08-03 00:00:00");
    2012-08-03 00:00:00
    

    (Note 2012-08-03 instead of 2012-08-3.)

    In addition, make sure that the values in your ALARMTIME are correctly formatted too.

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

Sidebar

Related Questions

Need to query my SQL server from Access using an ADO connection (for example),
I need a SQLite query that searches 1 field only using LIKE. Basic example:
I need a query which can do the following operation. I have a table
I need to query a table in an SQLite database to return all the
suppose I have the following tables sqlite> SELECT * FROM Artists; ArtistID|ArtistName 1 |Peter
I need to query one object with its related objects, I am using the
I need to query statistics about duplicate values in my database table. For example,
I need to query large amount of data from a database via C# and
I need to query AD to determine if a users account is disabled. Using
I am using SQLite in Java code through Zentus . I need to map

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.