with f as (select * from cmnbatch.plan_table order by bind_time desc fetch first 1000 rows only ) select bind_time, count(*), min(progName) from f group by bind_time order by bind_time desc with ur