|
|
Archives of the TeradataForum
Message Posted: Tue, 21 Sep 2004 @ 23:07:10 GMT
Subj: | | Re: Rank() and Partition By with Large Tables |
|
From: | | Michael Larkins |
Hi Remo:
You are close, but mixing and matching old with new formats. You are doing aggregation with OLAP - not compatible and you are mixing the GROUP
BY of the Teradata extension functions with the PARTITION BY of the newer ANSI functions. Your query should probably be something like this:
Select
Field1
,Field2
,Rank() OVER (Partition by Field1 Order By Total_usage Desc) Ranked
FROM (sel Field1, field2, Sum(Usage) as total_usage
FROM GROUP BY 1,2)
QUALIFY Ranked < 11
Hope this helps,
Michael Larkins
Certified Teradata Master
Certified Teradata SQL Instructor
| |