Re: SQL UNION Question (or not UNION?)
- From: "Bob Butler" <tiredofit@xxxxxxxxxxx>
- Date: Mon, 11 Dec 2006 10:37:32 -0800
<johnrou@xxxxxxxxxxxxxxxxxx> wrote in message
news:1165861376.324576.246770@xxxxxxxxxxxxxxxxxxxxxxxxxxx
<cut>
SELECT DISTINCT Last_Name as LName, First_Name as FName, Middle_Name
as MName From Table1 UNION SELECT DISTINCT LastName as LName,
FirstName as FName, MiddleName as MName From Table2
Works great except I can't tell which table it came from.... any help
is appreciated....
SELECT DISTINCT Last_Name as LName, First_Name as FName, Middle_Name
as MName,1 as FromTable From Table1
UNION
SELECT DISTINCT LastName as LName,
FirstName as FName, MiddleName as MName, 2 as FromTable From Table2
Note that if you have duplicates across the tables you'll now see both of
them since the 'fromtable' field will be different
--
Reply to the group so all can participate
VB.Net: "Fool me once..."
.
- Follow-Ups:
- Re: SQL UNION Question (or not UNION?)
- From: johnrou
- Re: SQL UNION Question (or not UNION?)
- References:
- SQL UNION Question (or not UNION?)
- From: johnrou
- SQL UNION Question (or not UNION?)
- Prev by Date: SQL UNION Question (or not UNION?)
- Next by Date: Re: SQL UNION Question (or not UNION?)
- Previous by thread: SQL UNION Question (or not UNION?)
- Next by thread: Re: SQL UNION Question (or not UNION?)
- Index(es):
Relevant Pages
|
Loading