0

i have a netezza table(transactions table)where there are multiple entries for one account number. 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(i.e. 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).

I have to write a sql query for netezza for this .how can i do so???....

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

1 Answers1

1

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
Dan Bracuk
  • 20,699
  • 4
  • 26
  • 43