3

I have a query that spits out multiple result tables and I want to be able to select all of the tables at once, hit copy and then paste them all to one Excel file all at the same time. I would also be ok with exporting, if someone knows how to do that.

Note: I do not want to change the default settings, just want to be able to do this for this one query.

Update: I should have specified in my original question that the column in different tables do not match.

tarheel
  • 423

1 Answers1

1

If all your columns are the same in each sub query, then you can put a UNION ALL between them and they will all append to the same query. The columns all have to be the same names and in the same order for this to work. If they are close but not exact, you can do things like add empty columns to one query so it will match another query. For example, if the first query has Name, Rank and Serial for the results, but the second query only has Name and Serial, you can write it like this:

SELECT Name, Rank, Serial
FROM Table_A
UNION ALL
SELECT Name, '' AS Rank, Serial
FROM Table_B
techturtle
  • 9,376