I have the follwoing query:
My problem is that the Top(5) part of the query is being ignored and instead a random number of rows is returned. Somtimes no rows, sometimes 5, sometimes 10. If I change the Order by NEWID() to Order by Column1 then the Query works fine and the expected number of rows is returned. This leads me to think there is some kind of conflict between the Top function and the Order by NEWID().
Any ideas what might be happening?
Thanks,
Steve
Code:
SELECT Column1, Column2 FROM Table1 WHERE Table1.Column1 IN ( SELECT TOP (5) Column1 FROM Table2 ORDER BY NEWID() )
Any ideas what might be happening?
Thanks,
Steve
Comment