[英]how to finding max of a column which has same values in different rows in netezza
i have a netezza table(transactions table)where there are multiple entries for one account number. 我有一个netezza表(交易表),其中一个帐号有多个条目。 i have to pick the latest entry for that account number based on the latest transaction date.if transaction dates are different for that account number i can pick the record with the max transaction date(ie the latest record).
我必须根据最新交易日期为该帐号选择最新条目。如果该帐号的交易日期不同,则可以选择具有最大交易日期的记录(即最新记录)。
But for some account number in all the entries of that account number the transaction date is also same . 但是对于该帐号的所有条目中的某个帐号,交易日期也相同。 in that case i have to pick the latest entry made in table for that account(say the latest row_number).
在这种情况下,我必须为该帐户选择表中的最新条目(例如最新的row_number)。
I have to write a sql query for netezza for this .how can i do so???.... 我必须为此写一个netezza的sql查询。我该怎么办?
Note:: in all the rows all the columns have same values as the row above them so i cannot do the above by differentiating the different rows on basis of some other column also 注意:在所有行中,所有列的值都与其上方的行相同,因此我无法通过基于其他某些列来区分不同的行来完成上述操作
Here is the general idea. 这是一般的想法。 You should be able to adapt it for your own tables.
您应该能够使其适合您自己的表。
select fred, barney, wilma
from flinstones join (
select max(Wilma) MaxWilma
from flinstones
where whatever) bedrock on Wilma = MaxWilma
where whatever
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.