Added windowed query into db_functions