Solve window-function SQL without joins | Other