Query conversion and retention with SQL windows | Other