March 22, 2005 01:22 PM
T-SQL Tiebreakers
Get the right query results
Rating:

(0)
SQL Server Magazine
InstantDoc ID #45235
A tiebreaker is a rule used to determine precedence between candidates when there's a tie. For example, when soccer teams have the same number of points in the league, the one with the higher goal difference takes precedence. A tiebreaker in T-SQL is a rule that determines which row your query will return if multiple rows have the same values for a given set of attributes. For example, suppose you were asked to return the most recent order for each employee from the Orders table. Returning the most recent order date for each employee requires a simple GROUP BY query with MAX(orderdate), but you also need to return other attributes besides the employee ID and the order date.
For...
...This article is for paid Professional Members only.
Already a Professional Member? Please log in now: