partition by range in sql