I find this query in some old code, but I am not an experienced SQL / data admin by any mean, Can someone please turn this turn query into some basic one without rank() over?