Re: Rolling retention
> For obvious reasons, I do not have access to insert records into the database
Um, obviously not into a production database. Into a test database.
> The tables I'm using already HAVE records in it, so why would I need to insert?
You're asked to post such SQL so helpers can understand your problem accurately, reproduce it, and test proffered answers to your questions.
> I would hope that folks would have a little more patience given I am a NEWBIE.
Newbie does not mean we do it for you, it means you're starting near the beginning, asking basic questions. What you misinterpret as impatience is just description of the basics of getting help with problems like this, ie how to post SQL for sample tables & data, and eventually, if you stick at it, how to port the SQL Server schema and query you posted to MySQL.
I asked about MySQL version because the SQL Server query you posted uses a Common Table Expression, and MySQL support for that begins only at version 8.0, so your best bet for this problem is to upgrade to MySQL version 8.0. Then all you'll need to do is tweak details like SQL dialect diffs, date formats, and date function syntax.
If that's not possible, you'll need to build SQL for your requirement from scratch. That'll be harder. If you're not experienced in writing SQL queries, harder still---in that case the starting point needs to be a detailed, completely specific statement of the requirement (in other programming contexts it's called pseudocode). That statement of the requirement will identify the SQL building blocks we'll need, and we'll go on from there to build the query step by step.
Edited 1 time(s). Last edit at 12/03/2018 12:53PM by Peter Brawley.