Strange - I'm sure I wrote a message here...
Did I forget to post?
Anyway, one more time - using the derived table is the correct approach for this problem, since TOP clause applies to the first select and then the second select (from UNION ALL part) brings all records satisfying the condition.
>I have this SQL and I cannot understand why it returns 11 rows when there is a TOP 10 syntax:
>
>
>DECLARE @Enabled Bit
>DECLARE @Public Bit
>DECLARE @Public2 Bit
>
>SET @Enabled=1
>SET @Public=1
>SET @Public2=1
>
>SELECT TOP 10 Class.Title,Class.Notes,Class.AddDate,Class.ModDate,Class.Numero
> FROM Class
> UNION ALL
> SELECT ClassMethod.Title,ClassMethod.Notes,ClassMethod.AddDate,ClassMethod.ModDate,ClassMethod.Numero
> FROM ClassMethod
> ORDER BY AddDate DESC
>
If it's not broken, fix it until it is.
My Blog