MySQL Forums
Forum List  »  Newbie

Re: Rolling retention
Posted by: Peter Brawley
Date: December 03, 2018 12:32PM

> 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.

Options: ReplyQuote


Subject
Written By
Posted
November 23, 2018 09:39AM
November 23, 2018 11:23AM
November 23, 2018 12:31PM
November 23, 2018 02:56PM
November 23, 2018 03:52PM
November 23, 2018 08:39PM
December 03, 2018 10:13AM
Re: Rolling retention
December 03, 2018 12:32PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.