July 1, 2014

Teradata: How to fetch the latest transaction from a history of transaction?

An example:

select  
 empl_hist.*
from  dim_empl_hist empl_hist
qualify
 1 = row_number() over(partition  by empl_hist.empl_num order by empl_hist.empl_hist_key desc)
where
 empl_status = '1'

No comments:

Post a Comment