• And if you're using SQLServer2000, then you'll need to use a "TOP n" correlated subquery, since ROW_NUMBER() is not available.. eg:

    select RecentVersion.*

    from(select distinct ProductId from dbo.ProductVersion) ProductList

    inner join dbo.ProductVersion RecentVersion

    on RecentVersion.ProductId = ProductList.ProductId

    and cast(RecentVersion.Version as varchar(10)) + '.' + cast(RecentVersion.MinorVersion as varchar(10)) + '.' + cast(RecentVersion.ReleaseVersion as varchar(10)) = (

    select top 1 cast(x.Version as varchar(10)) + '.' + cast(x.MinorVersion as varchar(10)) + '.' + cast(x.ReleaseVersion as varchar(10))

    from dbo.ProductVersion x

    where x.ProductId = RecentVersion.ProductId

    order by x.Version desc, x.MinorVersion desc, x.ReleaseVersion desc

    )