Hi,I'm trying to run a query that looks like this in order to use it as a basis for a data transfer job:SELECT top 20 * from myTable where DATEADD(dd, 0, DATEDIFF(dd, 0, datEventDate )) = '2011-11-19 00:00:00'unionSELECT top 20 * from myTable where DATEADD(dd, 0, DATEDIFF(dd, 0, datEventDate)) = '2011-11-18 00:00:00'unionSELECT top 20 * from myTable where DATEADD(dd, 0, DATEDIFF(dd, 0, datEventDate)) = '2011-11-17 00:00:00'
But the union operator doesn't work here because there's an XML column in the table which "cannot be selected as DISTINCT because it is not comparable".I just need a query that's going to get the top 20 data rows per day for a small range of dates. But everything else I've written so far - using CTE's, Rank/Partition and so on fails because the table is massive - 5935198 rows - and they take too long to run. What's the quickest solution?Cheers,Matt