Start Free Trial
Come for the solution, stay for everything else.
Start Free Trial
Select Results on a Rolling Time Period
I'm using PHP/MySQL to return data sets on a daily basis.
But what's the WHERE clause statement to extract results from a SELECT query perhaps on a rolling weekly, monthly or quarterly basis?
I'm asking so that the Select query returns a constant moving set of results set based on the data found in the database.
8/22/2022 - Mon
ASKER CERTIFIED SOLUTION
Log in or sign up to see answer
Become an EE member today
7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform
Sign up - Free for 7 days
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
See how we're fighting big data
Not exactly the question you had in mind?
Sign up for an EE membership and get your own personalized solution. With an EE membership, you can ask unlimited troubleshooting, research, or opinion questions.
ask a question
Yes so a typical query might look like: -
SELECT orderID, buyerName, BuyerAddress1, BuyerAddress2, BuyerAddress3, buyerCounty, buyerPCD, catID, quantity, totalPrice FROM salesuk WHERE invoiceDate >= "01/01/2017" ORDER BY DESC;
That type of query ... hope that helps?
Can you provide some sample data and expected result?
This is the code I was looking for, which produces a 21 rolling day view: -
WHERE invoiceDate >= now() - INTERVAL 21 DAY
This is the best money I have ever spent. I cannot not tell you how many times these folks have saved my bacon. I learn so much from the contributors.
Thanks for the prompt made me realise I knew enough to work it out!
Plans and Pricing
Certified Expert Program
© 1996-2023 Experts Exchange, LLC. All rights reserved. Covered by US Patent