>>I don't see an ORDER BY field in your example. ORDER BY 1 is no order - do you want them to be in the clustered index order?
>
>This is the SQL:
>
>
>DECLARE @NoMember Integer
>
>SET @NoMember=1
>
>SELECT Thread.Numero,Thread.Title,Thread.Url,Thread.AddDate
> FROM (SELECT TOP 10 Reply.NoThread FROM Reply (NOLOCK) WHERE Reply.NoMember=@NoMember ORDER BY 1 DESC) Temp
> INNER JOIN Thread ON Temp.NoThread=Thread.Numero
>
>
>Basically, this is the one showing the last 10 replies in the Dashboard. So, ordering by 1, thus by Reply.NoThread, in DESC, would give the most recent ones as NoThread is the Thread.Numero reference, which is the primary key. Or, is it that ORDER BY 1 serves for no use in SQL Server and that I would have to use ORDER BY Reply.NoThread?
I think it works OK in SQL Server, but better to use field names. I got confused myself - thanks to Tracy for setting me straight.
BTW, out of curiosity, can you compare your query with mine and tell which one is faster?
If it's not broken, fix it until it is.
My Blog