SQLTeam.com | Weblogs | Forums

Select date based on min value in another column



I have 2 columns in a single table. One column are all date values the other column's data are all integers. How can I get the date from the date column based on the minimum value in the column of integers? Thanks for all and any help.

SELECT	IntegerColumn, DateColumn
	SELECT	[T_RowNumber] = ROW_NUMBER()
--				PARTITION BY OptionalPartitionColumn(s)
				ORDER BY IntegerColumn DESC
	FROM YourTable
) AS T
WHERE	T_RowNumber = 1
-- ORDER BY SomeColumn


Thank you very much. Works like a charm and thank your for your fast response.