> I am trying to select a date range in this format from a database 1-Mar-03 > to 26-Mar-03. The date is stored in a mySQL database in that format and when > doing a normal select it just selects the dates as if they are numbers. > > How can I make this select work the way I want it to work? I am using the > following query: > > "SELECT * FROM members WHERE member_date >= '01-Mar-03' AND member_date <= > '26-Mar-03' ORDER BY member_date";
Your dates are just strings. You can't say whether one string is greater or less than another. How do you expect MySQL to know they are dates. Use a DATE column like you're supposed to, and you can do the query just like you have it above. The MySQL format for dates is YYYY-MM-DD. You can use the DATE_FORMAT() function to re-format it back into DD-MMM-YY if that's what you really need to show. Or, you could do the whole thing with Unix timestamps and and INT column. The way you have it now, you're kind of screwed. ---John Holmes... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php