Teradata - How can I extract all rows of a partition using the qualify statement? -


i have data in table looks following

username     loaddate --------    ---------- gittes1     2016-01-25 gittes1     2016-01-25 gittes1     2016-01-25 gittes1     2016-01-24 gittes1     2016-01-23 

is there way can extract rows gittes1 loaddate = 2016-01-25 using qualify statement. number of rows in partition can vary 0 n .. , there multiple such users.

if want records earliest loaddate per username, try

select username, loaddate table    qualify rank() on (partition username order loaddate asc) = 1; 

if want records latest loaddate instead, replace asc desc in above.


Comments

Popular posts from this blog

javascript - jQuery: Add class depending on URL in the best way -

caching - How to check if a url path exists in the service worker cache -

Redirect to a HTTPS version using .htaccess -