Teradata has Rank function which will help u get the top n values. something like this
select
sub.city_desc,
sub.sales_value,
rank(sub.sales_value)
from
(
select
city_desc as city_desc,
sum(sales_value) as sales_value
from
city_sales
group by
city_desc
)as sub
qualify rank(sales_value) <= 5
the above sql will get u the top 5 cities based on sales value.
I believe that you meant a function similar to the CEIL function in Oracle and opposite to the FLOOR function. The CEIL function provides the smallest integer that is >= to a specific value.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.