0o0o0 Posted February 19, 2016 Share Posted February 19, 2016 What does one use to make this from 2 weeks to 1 month ago?This is now till a month ago ( in days) WHERE date > DATE_SUB(NOW(), INTERVAL 1 MONTH) How do you change NOW() to 14 days ago, INTERVAL 1 MONTH WHERE date > DATE_SUB(NOW(), INTERVAL 1 MONTH) tried... - 14 14 DAY 14 DAYS - 14 ) NOW(-14) NOW() - 14 Nothing on the net i found in roughly 60 searches matched anything ive tried to do. So... basically find everything in the db from 14 days ago.. to 1 month ago. on going rolling day to day.. I mean everyday no solid dates used the query.. so in 14 days from now (MAR 4) it would show Feb 19 (todays entires) to jan 19th Thanks. Quote Link to comment Share on other sites More sharing options...
Barand Posted February 19, 2016 Share Posted February 19, 2016 ... WHERE date BETWEEN CURDATE() - INTERVAL 1 MONTH AND CURDATE() - INTERVAL 14 DAY Quote Link to comment Share on other sites More sharing options...
benanamen Posted February 19, 2016 Share Posted February 19, 2016 (edited) *Edit: Nevermind, I didnt understand you wanted a range. This is a correct query. Run it by itself. You will have to figure out what is up with your data assuming you have a correct date column and format. SELECT DATE_SUB(NOW(), INTERVAL 14 DAY) Edited February 19, 2016 by benanamen Quote Link to comment Share on other sites More sharing options...
0o0o0 Posted February 19, 2016 Author Share Posted February 19, 2016 well its pretty safe to say "Barand" has taught me everything I know in sql and php. thanks again! Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.