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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T14:33:58+00:00 2026-05-28T14:33:58+00:00

I am trying to query an sql database and I am having trouble. Is

  • 0

I am trying to query an sql database and I am having trouble. Is there an error with the syntax below or is it something else that I am missing?

SELECT Name, DateTime, num1, num2 
FROM names_E6 
WHERE DateTime between '2012-1-27' AND '2012-1-27' 
WHERE num1 between '0' AND '5' 
WHERE num2 between '0' AND '6'
  • 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-05-28T14:33:59+00:00Added an answer on May 28, 2026 at 2:33 pm

    In addition to the answers regarding the syntax, I would like to add a comment on the usage of value literals:

    If num1 and num2 are numbers, the condition should be

    AND num1 between 0 AND 5  
    AND num2 between 0 AND 6
    

    Note the missing single quotes around the numbers. Some DBMS will not even allow a conversion from a character literl '5' to a number, others might surprise you with strange results and most of them will not use an index on the column if such an implicit type casting is successful.

    You should also be aware that the expression DateTime between '2012-1-27' AND '2012-1-27' might not always work correctly due to the implicit type casting (String -> Date) and locale settings of the server and/or client. To be on the safe side you should use e.g. the ANSI standard for a date literal:

     DateTime between DATE '2012-01-27' AND DATE '2012-01-27'
    

    Note the keyword DATE to start a date literal and the month given with two digits.

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

Sidebar

Related Questions

I'm having trouble with my sqlite database. I'm trying to write an query that
I am having trouble displaying results from a SQL query. I am trying to
I'm currently trying to run a LINQ query over a MS SQL database. This
I'm trying to learn LINQ to SQL and I'm able to query the database
I'm trying to write an SQL query that would search within a CSV (or
I'm trying to convert this SQL query to LINQ: SELECT Items.p_Name Product, DiamondCategory.dc_Name Category,
I'm having some trouble trying to use timestamp2 instead of Timestamp in SQL Server
I'm trying to query my SQL database to get the number of orders made
im trying to create a sql query, that will detect (possible) duplicate customers in
I'm having an issue trying to get my SQL query which works fine 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.