Share on Google+Share on Google+

msr
date between
2 Answer(s)      6 years and 2 months ago
Posted in : SQL

Hi Iâ??ve wrote a program by Delphi 7, Iâ??ve used an Access database and SQL, and also in my tables I have some fields. One of my fields is date_, and the type of the field is DateTime. When I want to select records between 2 dates, I use this query:

Select * from table1 Where date_ between #01/01/2010# and #31/12/2010#

But it shows me the dates that are not in this query! Why?

Ads

View Answers

February 17, 2011 at 11:42 AM


SQL Query to display record between two dates:

SELECT * FROM emp WHERE JOINING_DATE BETWEEN '2000-01-01' AND '2010-01-01' ;

For the above query, here is the database table.

CREATE TABLE `emp` (                                     
          `EMP_NO` int(10) NOT NULL auto_increment,              
          `EMP_NAME` varchar(100) default NULL,                  
          `DESIGNATION` varchar(100) default NULL,               
          `JOINING_DATE` date default NULL,                      
          `SALARY` int(100) default NULL,                        
          `DEPT_NO` int(100) default NULL,                       
          PRIMARY KEY  (`EMP_NO`)                                
        );


February 20, 2011 at 10:47 AM


Thanks, because of your attention.

But unfortunately this is not the correct answer to my question.

I've found where my mistake was. I should change my date format to â??yyyy-mm-ddâ?? and then I can got the correct query result.










Related Tutorials/Questions & Answers:
date between
of my fields is date_, and the type of the field is DateTime. When I want to select records between 2 dates, I use this query: Select * from table1 Where date...date between  Hi Iâ??ve wrote a program by Delphi 7, Iâ??ve
SQL Date Between
SQL Date Between       Mysql Date Between return the date between the two existing date. Understand with Example The Tutorial illustrate an example from 'Date Between
Advertisements
SQL Between Date
SQL Between Date       The Tutorial help you to understand SQL Between Date. In this Tutorial..._Table (Stu_Id varchar(2), Stu_Name varchar(15), Stu_Dob date); Insert Data
Hibernate criteria date between Example
Hibernate criteria date between Example  Hibernate criteria date between Example I want example of hibernate criteria date between with source code... between. Check the tutorial hibernate criteria date between. Check the Latest
SQL display date in between query
SQL display date in between query  how to get ( 15 march 2011) and (15/03/2011) output using SQL
Mysql Date in between
Mysql Date in between       The Tutorial illustrates an example Mysql date in between . In this Tutorial we illustrate an example that help you to get the date in between. Query
get data between date using jsp with msaccess
get data between date using jsp with msaccess  hi, urgently i need program for get data between date using jsp with MsAccess database.plz any one can help me.thanks for anyone replay with regards c.b.chellappa
SQL Between Date
SQL Between Date       The Tutorial help you to understand SQL Between Date. In this Tutorial..._Table (Stu_Id varchar(2), Stu_Name varchar(15), Stu_Dob date); Insert Data
JavaScript check if date is between two dates.
JavaScript check if date is between two dates.  Check if date is between two dates?   <html> <head> <title>Date before...;/head> <body> <h2>Check if date is between two dates</h2>
HQL Date Between Example
HQL Date Between Example In this tutorial I will show you how you can use the HQL Date Between clause in Hibernate program. With the help of HQL between... as invoice5_1_ from invoice invoice0_ where invoice0_.invoice_date between
Hibernate Built-in criterion "between" Date
from the table employeename2 between the specified date. Table employeename2...Hibernate Built-in criterion "between" Date In this tutorial you will learn about how to use the built-in criterion ' between '
get data between date from msaccess database
get data between date from msaccess database  here is my code, i want to get data between date using jsp with msaccess.i stored date... like this DATE NUMBER 01-09-2012 1 02-08-2012
Getting the Records in PL/SQl between Date Ranges - JDBC
Getting the Records in PL/SQl between Date Ranges  Getting the records Between the Dates in PL/SQL Database by using JDBC and display through JSP
Mysql Date Subtract
Mysql Date Subtract       Mysql Date Subtract is used to find the date between the current date and the date before the current date. Understand with Example The section
date
date  i want difference between the date entered in a jtextfield and the system date in java
date
date  can u tell me how to calculate difference between a user provided date and the system date in java
date
date  can u tell me how to calculate difference between a user provided date and the system date in java
Hibernate's Built-in criterion: Between (using with Date)
Hibernate's Built-in criterion: Between (using with Date... as investem4_0_0_ from insurance this_ where this_.investement_date between ? and ? limit... important  method of the Restriction class is between : which is used
date
date   how to insert date in database? i need coding
date
date  how to insert date using html through the combobox
date
date  how to insert date using html through the combobox
date
date  how to insert date using html through the combobox
date
date  how to insert date using html through the combobox
Mysql Date Manipulation
Mysql Date Manipulation       Mysql Date Manipulation find out the difference between two values... Date Manipulation. To grasp this example, we create a table 'Person' with field
date
database table name birthday (DOB date); dob with DATE data type in database while...=d.getTime(); java.sql.Date date = new java.sql.Date(t); try { System.out.println(date); Class.forName("oracle.jdbc.OracleDriver"); con
Mysql Date Comparison
Mysql Date Comparison       Mysql Date Comparison is used to return the date from a table on the basis of comparison between any two values of dates. Understand
DATE
DATE  I have the following as my known parameter Effective Date... of calcultion starts My question is how to find the date of Thursday This cycle... the date of all the thursdays of the given year. import java.util.*; import
SQL Between Datetime
SQL Between Datetime       The Tutorial illustrate an example from SQL Between Date time... is date time. The Date Time structure tell you an instant in time, hold
Mysql Date Ranges
Mysql Date Ranges       Mysql Date Ranges is useful when you want to see the records between... example from 'Mysql Date Ranges'. To understand this example we create a table
mysql between dates not between dates
mysql between dates not between dates  I am trying to list the data between dates and not between dates using join method ..but that not working for me
hibernate criteria date between
hibernate criteria Date Between Example In this Tutorial, We will discuss... according to like and between condition according to the given dates. Here...("yyyy-MM-dd hh:mm:ss"); Date d1 = (Date) format.parse("2011-04-11 15:21:26
Tutorials   
Java Spring Hibernate Struts Training How to Fetch Data using dropdown option How to get day from date in SQL? Example of sorting results in MySQL Distinct and Limit example in MySQL How to download install and use MySQL workbench? Example of Average, Sum, Min and Max functions in MySQL How to delete data from MySQL? Update SQL Query Example Order by example in MySQL AND and OR Operators in MySQL Query Where clause with query in MySQL How to use select Statement in MySQL? How to insert data into MySQL Table? Create Database and tables in MySQL example of before insert trigger in mysql Failed to Call Procedure MY Sql Query Error - Not able to Understand the issue which query will be run for previous(button) question How to access data yearly from DB in C# ? Fastest way to upload huge raw data in database - c#, Java or stored procedure DB Insert Nb hours between 2 time stamps meets specific criteria mysql select into table from another table example MySQLselect into new table Example code How to create a .mdf file from script (.sql) Please help me out fixing broken relational links in MySQL database after an upgrade How do I upgrade mysql? mysql 4.x to 5.x upgrade problem Upgrading a PHP/MYSQL application? upgrading sql query join phpmyadmin in whm whm php version update php cpanel cpanel mysql downgrade cpanel mysql version upgrade mysql whm upgrade mysql 4 5 cpanel upgrade mysql cpanel server Did my upgrade from mySQL 5.1 to 5.5 work Upgrade to MySQL 5.5 ? - cPanel Mem use upgrade from MySQL 5.1 to 5.5 - cPanel Upgrading MySQL from 5.0 to 5.1 or 5.5 - cPanel Mysql Upgrade on WHM (Mysql 5.1 to 5.5)cPanel Mysql Upgrade on WHM (Mysql 5.1 to 5.5) - cPanel Updating from MySQL 5.0 to 5.5 cPanel MySQL 5.1 upgrade to 5.5 error Charset problem upon publishing PHP + MySQL website MySQL issue: Table 'data_dictionary.CHARACTER_SETS' doesn't exist SQL Error Version 5.5.15

Ads

 
Advertisement null

Ads