Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 Site Related Forums
 Article Discussion
 Article: UNION: Selecting from multiple tables in one statement

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2000-07-31 : 17:00:42
Rick writes "I am trying to design an ASP page that allows the user to input one or more parameters to search on. When they click on submit, I need to build a SQL statement that reflects their desired choices. The information they can search on, is spread across multiple tables." We'll cover the UNION statement which allows you to join multiple select statements together.

Article Link.

lghigliani
Starting Member

1 Post

Posted - 2002-03-21 : 16:01:45
Hi, I am trying to do so with an Access db, and appears to fail.
Is that "adding extra fields in a query" an SQL Server exclusive feature?

If so, how could I retrieve each record's original table in a multiple UNION clause?

I mean:

SELECT name , id FROM table1
UNION ALL
SELECT name.....

Result:

John - Table1
Peter - Table3
Nicholas - Table2

Thank you
Leonardo

Go to Top of Page

Piyush
Starting Member

8 Posts

Posted - 2011-07-25 : 02:24:10
Difference between Union and Union All?
SQL Server- Union and Union All…..it’s not the same stuff…
unspammed

Piyush Bajaj
Go to Top of Page
   

- Advertisement -