top button
Flag Notify
    Connect to us
      Site Registration

Site Registration

We have multiple queries and we have to show result set of all queries as one result. What we have to do?

+2 votes
283 views
We have multiple queries and we have to show result set of all queries as one result. What we have to do?
posted Jan 8, 2015 by Vrije Mani Upadhyay

Share this question
Facebook Share Button Twitter Share Button LinkedIn Share Button

1 Answer

0 votes

Combine the select queries in SQL view

1- On the Create tab, in the Queries group, click Query Design.
A new query opens in Design view.

2- Close the Show Table dialog box.

3- On the Design tab, in the Query group, click Union.

The query design window is hidden, and the SQL view object tab is displayed. At this point, the SQL view object tab is empty.

4- Click the tab for the first select query that you want to combine in the union query.

5- On the Home tab, in the Views group, click View, and then click SQL View.
The SQL statement for the select query is displayed.

6- Copy the SQL statement for the select query.

7- Click the tab for the union query that you started to create at step 1 of this procedure.

8- Paste the SQL statement for the select query into the SQL view object tab of the union query.

9- Delete the semicolon (;) that is at the end of the select query SQL statement.

10- Press ENTER to move the cursor down one line, and then type UNION on the new line.
Optionally, type a space, followed by the ALL keyword, and then press ENTER again.

11- Click the tab for the next select query that you want to combine in the union query.

12- Repeat steps 5 through 11 of this procedure until you have copied and pasted all of the SQL statements for the select queries into the SQL view window of the union query. Do not delete the semicolon or type anything following the SQL statement for the last select query.

13- On the Design tab, in the Results group, click Run.
The results of your union query appear in Datasheet view.

answer Jan 19, 2015 by Rahul Singh
...