Jump to content

Help With Mysql Select Between/where


whelpton

Recommended Posts

Hey guys,

 

First of all, thanks for reading my post, its much appreciated.

 

I've been roped into trying to develop a system to work with a large CSV file, which I believe should be ported into a mysql db to start off with then processed via php.

 

The only issue comes into searching through the DB and finding a specific date range, I am trying to use the mysql between code such as this:

 

SELECT * FROM sample WHERE `order_date` >= "01/01/2010" and `order_date` < "30/12/2010"

 

But I still get order_date's that are outside of that date range.

 

Any ideas?

Link to comment
https://forums.phpfreaks.com/topic/272311-help-with-mysql-select-betweenwhere/
Share on other sites

Re-import it using MySQL's STR_TO_DATE() function to get the date in the right format,

add a new field and UPDATE the date into the new field with STR_TO_DATE()in the proper format and use that field for the comparisons,

or use STR_TO_DATE() on the values in your comparisons.

I imagine a pain in my processor's arse to change through code

 

It would be a total of one UPDATE query, without a WHERE clause, to convert the existing value and set a new column to the corresponding YYYY-MM-DD value, all at once.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.