>I would like to retrieve the count from a derived SQL. I am not sure about the best approach to use. This is the SQL I have:
>
>
>SELECT Temp.NoThread
>FROM
>(SELECT Top 10 NoThread FROM Thread ORDER BY Numero DESC) Temp
>
>
>So, in the result, I get all the keys that I need for the most recent 10 threads. However, based on those keys, I would now like to include a column for the count. Thread.NoThread have several occurences in the table. So, the result would include a column for the count having a value from 1 to x.
Or do you want to include the count for NoThread in the original Table? If so, you need to do a separate subselect (derived table).
If it's not broken, fix it until it is.
My Blog