I asked this question and I found a perfect solution, but then I realized that my company uses an older MySQL version than my local one and part of the code doesn't work. So now I would like to ask about alternatives for code placed in answer, but I'm not sure about that...
Should I:
- Edit my question and add at the end something like "EDIT I use MySQL 5.7 " (with this one, answers for all versions of MySQL will be in one topic, but the solution of the problem is already there, so the point now isn't to look for a new solution, but just to translate of an existing one)
BENEFIT: If someone will look for "How to left join with first matching row and fill the rest with null?", he will see how to do that in every version of MySQL.
- Ask about code alternatives for
LAG... OVER (PARTITION BY... ORDER BY...)
in MySQL 5.7? (with this I can open a new question about a specific problem, where the previous solution is just an example to translate)
BENEFIT: If someone will look for "What's the LAG... OVER (PARTITION BY... ORDER BY...)
alternative in MySQL 5.7, a new question will perfectly fit his needs.
So both solutions can be quite beneficial, but which one is better in this situation?