Informatica:如何从多行中选择排序的记录或在 Informatica 中同时取两列的最大值

Informatica: How to pick the sorted record from multiple rows or take the max on two columns together in Informatica

我有如下要求。

来源:

   prod_id          DATE              Price      Count(Price)

   1          01-02-2017              100             1  

   1          01-02-2017              10             4          

   2          02-02-2017              50             1

   2          02-02-2017              60             1

我有这样的数据。现在我需要为每个唯一的 prod_iddate 组合选择 max(count(Price)) 的记录,但是如果 Count(price) 相同那么它应该采用 max(price) 或对列进行排序在 Count(price)price 的基础上,选择最高记录。我通过使用聚合器执行 group by prod_id, date column 并在 price 上获取 count 而不是直接 table 来获取此数据。我怎样才能做到这一点?有什么建议吗?

谢谢, 朴雅卡

根据 Count(Price) 和 Price 按该顺序对记录进行排序,并使用以 prod_id 和日期为键的聚合器。不要使用任何聚合函数。聚合器将传递每个组的最后一条记录。

因为你标记了Teradata,你可以通过添加直接获取它

select .....
qualify
   row_number()
   over(partition by prod_id 
        order by Count(Price) desc, Price desc) = 1      

您当前的查询。