MySQL return All records between two dates

thomasjcf21

I am trying to retrieve all records between two dates and the MySQL query is bringing back records with a completely different date.

My Query Is

SELECT datecreated FROM TABLE_COMPLAINTS WHERE datecreated BETWEEN '01/08/2015' AND '24/08/2015'

The result from that query is this:

enter image description here

As you can tell the dates returned are not in the boundary specified in the SQL Query.

My Question is how do I fix this?

Chaibi Alaa

Try this

SELECT datecreated FROM TABLE_COMPLAINTS WHERE datecreated BETWEEN
 to_date('01/08/2015','MM/DD/YYYY') AND to_date('24/08/2015','MM/DD/YYYY')

Solution 2

SELECT datecreated FROM TABLE_COMPLAINTS WHERE datecreated >='01/08/2015' AND datecreated <= '24/08/2015'

Solution 3

SELECT datecreated  FROM TABLE_COMPLAINTS 
where 
    datecreated >='01/08/2015 06:42:10' and datecreated <='24/08/2015 06:42:50';

Forgive me I didn't see that Time part I thought it is a different column. This should work (I messed with time field to see if there is a difference as all your Times are in 12)

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

Mysql procedure to update difference between two dates for all records

From Dev

Retrieve records between two dates in mysql?

From Dev

MySQL get number of records in each day between two given dates

From Dev

Finding records between two dates

From Dev

MySQL: Select all data between range of two dates

From Dev

Return data between two dates

From Dev

Return data between two dates

From Dev

Count number of dates in a interval using between on postgress timestamp return 0 records all the time

From Dev

Select All dates between two dates

From Dev

How to generate all dates between two dates

From Dev

Get records between two String dates

From Dev

Search records between two dates - Ruby on Rails

From Dev

SQL Server: Find records between two dates

From Dev

How to get records located between two dates (month and day) for all the years in my table?

From Dev

Filter between two dates MYSQL

From Dev

Mysql Delete between two dates

From Dev

MYSQL get between two dates

From Dev

MySQL Date and Interval - records between dates

From Dev

MYSQL - Fetch records between two dates using GROUP BY and INNER JOIN from one table

From Dev

retrieve records between fromdate and todate passing two dates and foreign key value in MYSQL or HQL

From Dev

sybase get records between two dates, being the dates expressed as VARCHARS

From Dev

mySQL query between two dates and two times

From Dev

eloquent return two columns all records

From Dev

JavaScript: get all months between two dates?

From Dev

How to list all months between two dates

From Dev

How to select all hours between two dates?

From Dev

List all days between two dates in Oracle

From Dev

Get all years between two dates in python

From Dev

All dates between two Date objects (Swift)

Related Related

  1. 1

    Mysql procedure to update difference between two dates for all records

  2. 2

    Retrieve records between two dates in mysql?

  3. 3

    MySQL get number of records in each day between two given dates

  4. 4

    Finding records between two dates

  5. 5

    MySQL: Select all data between range of two dates

  6. 6

    Return data between two dates

  7. 7

    Return data between two dates

  8. 8

    Count number of dates in a interval using between on postgress timestamp return 0 records all the time

  9. 9

    Select All dates between two dates

  10. 10

    How to generate all dates between two dates

  11. 11

    Get records between two String dates

  12. 12

    Search records between two dates - Ruby on Rails

  13. 13

    SQL Server: Find records between two dates

  14. 14

    How to get records located between two dates (month and day) for all the years in my table?

  15. 15

    Filter between two dates MYSQL

  16. 16

    Mysql Delete between two dates

  17. 17

    MYSQL get between two dates

  18. 18

    MySQL Date and Interval - records between dates

  19. 19

    MYSQL - Fetch records between two dates using GROUP BY and INNER JOIN from one table

  20. 20

    retrieve records between fromdate and todate passing two dates and foreign key value in MYSQL or HQL

  21. 21

    sybase get records between two dates, being the dates expressed as VARCHARS

  22. 22

    mySQL query between two dates and two times

  23. 23

    eloquent return two columns all records

  24. 24

    JavaScript: get all months between two dates?

  25. 25

    How to list all months between two dates

  26. 26

    How to select all hours between two dates?

  27. 27

    List all days between two dates in Oracle

  28. 28

    Get all years between two dates in python

  29. 29

    All dates between two Date objects (Swift)

HotTag

Archive