select top 10 * from ( select top 10 .... from .... where .... union select top 10 .... from .... where .... ) x
- main idea. Adding the top 10 to each connection means that a smaller set will be installed in the external request.
If you want to set priority (i.e. return as much as possible from the first result), you can do this:
select top 10 * from ( select top 10 1 as prio_col, .... from .... where .... union select top 10 2 as prio_col.... from .... where .... ) x order by prio_col
so that you get as much as possible from the first set and use only the results of the second set as a "backup".
davek source share