If you want to pull records for the last 7 days, you may use the following query.
SELECT * FROM sales_flat_order WHERE created_at >= (DATE(NOW()) - INTERVAL 7 DAY) ORDER BY created_at DESC
Did this post help you?
Tutsplanet brings in-depth and easy tutorials to understand even for beginners. This takes a considerable amount of work. If this post helps you, please consider supporting us as a token of appreciation:
- Just want to thank us? Buy us a Coffee
- May be another day? Shop on Amazon using our links.
Your prices won't change but we get a small commission.
TutorialSpan says
Can we optimized this query or it is optimized one?