Tags: , , ,

Use of Teradata Qualify Row Number

We can use Teradata Qualify Row Number to have an alternate solution to Group by clause or using distinct.Qualify works on the final set of result rows.Qualify row number we can use in order to have a specific record or number of records.We will understand how Qualify Row Number is useful by taking example of a case when we have SCD2 implemented in table and we want to select latest value for any column.Eg: If there is an employee in a table emp who has changed his location from one city to other in the same company.For SCD2 we will add a new record with new location for the employee and date from which it is effective.If requirement is to select only the latest location for all the employees we can use Qualify Row Number to obtain the desired result.
SQL Query will be somewhat like : Continue reading | 5 Comments

Continue Reading