SQL Server Forums
Profile | Register | Active Topics | Members | Search | Forum FAQ
 
Register Now and get your question answered!
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 Site Related Forums
 Article Discussion
 Article: UNION: Selecting from multiple tables in one statement
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

AskSQLTeam
Ask SQLTeam Question

USA
0 Posts

Posted - 07/31/2000 :  17:00:42  Show Profile  Visit AskSQLTeam's Homepage  Reply with Quote
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.

Anonymous
Starting Member

0 Posts

Posted - 02/27/2001 :  11:01:17  Show Profile  Reply with Quote
Using UNION to join tables

I am able to search across several tables using a UNION join, but why dose this not work with a "WHERE something LIKE '%keyword%'" clause?

Go to Top of Page

lghigliani
Starting Member

1 Posts

Posted - 03/21/2002 :  16:01:45  Show Profile  Reply with Quote
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

India
8 Posts

Posted - 07/25/2011 :  02:24:10  Show Profile  Visit Piyush's Homepage  Reply with Quote
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
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.09 seconds. Powered By: Snitz Forums 2000