September 23, 2016

Teradata sql - retrieve top and bottom 50 percentage of the records

Top 50%
----------
select top 50 percent  *
from table1
order by id asc

Bottom 50%
---------------
select top 50 percent  *
from table1
order by id desc

No comments:

Post a Comment