Fetching records between two date ranges in MySQL

If you want to get rows between two dates in MySQL you would use a query like the following:

SELECT * FROM `sales_date` WHERE date_of_sale BETWEEN ‘2009-01-01′ AND ‘2009-01-21′

The between evaluates to 1 if sales date lines within the range of 2009-01-01 and 2009-01-21. If you wanted to fetch all rows not in the date range you could us NOT BETWEEN

For more information or support by phone for MySQL please call us at 410-838-5100 or email us at
experts@expertsinunix.com
Skype: pts.support

 
fetching_records_between_two_date_ranges_in_mysql.txt · Last modified: 2010/08/23 10:56 by admin
 
Recent changes RSS feed Creative Commons License Donate Powered by PHP Valid XHTML 1.0 Valid CSS Driven by DokuWiki