|
 |
access thread: Combining two tables using Union
Message #1 by "Robert Germann" <robert_germann@e...> on Tue, 19 Nov 2002 15:10:41
|
|
I would like to combine two tables with exactly the same fields. I was
told to use the union to do this. I looked up in Access Help which says to
do this (Example 1) so I substuded my table names with the example. The
probel I get is for VB to come up with an Compile Error, highlighting the
word "UNION" and say "end of statement". Any suggestions as to why this
does'nt work?
Rob
Example 1:
TABLE tablename1 UNION TABLE tablename2;
Example 2:
TABLE AP3-WRA1_SUBCOMPUTE UNION TABLE AP3-WRA4_SUBCOMPUTE;
Message #2 by "Gerald, Rand" <RGerald@u...> on Tue, 19 Nov 2002 09:24:12 -0600
|
|
Try this:
SELECT * FROM tablename1 UNION SELECT * FROM tablename2;
Rand E Gerald
Database Specialist
Information Services / Operations
Bah=E1'=ED National Office
1233 Central St.
Evanston IL 60201
(xxx) xxx-xxxx
-----Original Message-----
From: Robert Germann [mailto:robert_germann@e...]
Sent: Tuesday, November 19, 2002 09:11
To: Access
Subject: [access] Combining two tables using Union
I would like to combine two tables with exactly the same fields. I was
told to use the union to do this. I looked up in Access Help which says
to
do this (Example 1) so I substuded my table names with the example. The
probel I get is for VB to come up with an Compile Error, highlighting
the
word "UNION" and say "end of statement". Any suggestions as to why this
does'nt work?
Rob
Example 1:
TABLE tablename1 UNION TABLE tablename2;
Example 2:
TABLE AP3-WRA1_SUBCOMPUTE UNION TABLE AP3-WRA4_SUBCOMPUTE;
Message #3 by braxis@b... on Tue, 19 Nov 2002 16:52:38 +0000 (GMT)
|
|
Rob
You are confusing your SQL with your VBA!
Try creating a new Query, changing the view to SQL and then type in the union query.
Brian
> from: Robert Germann <robert_germann@e...>
> date: Tue, 19 Nov 2002 15:10:41
> to: access@p...
> subject: Re: [access] Combining two tables using Union
>
> I would like to combine two tables with exactly the same fields. I was
> told to use the union to do this. I looked up in Access Help which says to
> do this (Example 1) so I substuded my table names with the example. The
> probel I get is for VB to come up with an Compile Error, highlighting the
> word "UNION" and say "end of statement". Any suggestions as to why this
> does'nt work?
>
> Rob
>
> Example 1:
> TABLE tablename1 UNION TABLE tablename2;
>
> Example 2:
> TABLE AP3-WRA1_SUBCOMPUTE UNION TABLE AP3-WRA4_SUBCOMPUTE;
Message #4 by "bwarehouse" <bwarehouse@y...> on Tue, 19 Nov 2002 12:00:27 -0700
|
|
Try:
SELECT * From tablename1
UNION ALL
SELECT * From tablename2;
Later,
b.ware
-----Original Message-----
From: Robert Germann [mailto:robert_germann@e...]
Sent: Tuesday, November 19, 2002 3:11 PM
To: Access
Subject: [access] Combining two tables using Union
I would like to combine two tables with exactly the same fields. I was
told to use the union to do this. I looked up in Access Help which says to
do this (Example 1) so I substuded my table names with the example. The
probel I get is for VB to come up with an Compile Error, highlighting the
word "UNION" and say "end of statement". Any suggestions as to why this
does'nt work?
Rob
Example 1:
TABLE tablename1 UNION TABLE tablename2;
Example 2:
TABLE AP3-WRA1_SUBCOMPUTE UNION TABLE AP3-WRA4_SUBCOMPUTE;
Message #5 by "Gerald, Rand" <RGerald@u...> on Tue, 19 Nov 2002 13:31:25 -0600
|
|
Hi b.ware,
It looks like both of us came up with the same solution except for the
"ALL".
The end user did not indicate how he wanted to handle duplicate
records.
Rand E Gerald
Database Specialist
Information Services / Operations
Bah=E1'=ED National Office
1233 Central St.
Evanston IL 60201
(xxx) xxx-xxxx
-----Original Message-----
From: bwarehouse [mailto:bwarehouse@y...]
Sent: Tuesday, November 19, 2002 13:00
To: Access
Subject: [access] RE: Combining two tables using Union
Try:
SELECT * From tablename1
UNION ALL
SELECT * From tablename2;
Later,
b.ware
-----Original Message-----
From: Robert Germann [mailto:robert_germann@e...]
Sent: Tuesday, November 19, 2002 3:11 PM
To: Access
Subject: [access] Combining two tables using Union
I would like to combine two tables with exactly the same fields. I was
told to use the union to do this. I looked up in Access Help which says
to
do this (Example 1) so I substuded my table names with the example. The
probel I get is for VB to come up with an Compile Error, highlighting
the
word "UNION" and say "end of statement". Any suggestions as to why this
does'nt work?
Rob
Example 1:
TABLE tablename1 UNION TABLE tablename2;
Example 2:
TABLE AP3-WRA1_SUBCOMPUTE UNION TABLE AP3-WRA4_SUBCOMPUTE;
Message #6 by "bwarehouse" <bwarehouse@y...> on Wed, 20 Nov 2002 04:52:54 -0700
|
|
I agree. I just saw your reply.. he should be ok with either or..
hopefully it helps him out..
b.ware
-----Original Message-----
From: Gerald, Rand [mailto:RGerald@u...]
Sent: Tuesday, November 19, 2002 12:31 PM
To: Access
Subject: [access] RE: Combining two tables using Union
Importance: High
Hi b.ware,
It looks like both of us came up with the same solution except for the
"ALL".
The end user did not indicate how he wanted to handle duplicate records.
Rand E Gerald
Database Specialist
Information Services / Operations
Bahá'í National Office
1233 Central St.
Evanston IL 60201
(xxx) xxx-xxxx
-----Original Message-----
From: bwarehouse [mailto:bwarehouse@y...]
Sent: Tuesday, November 19, 2002 13:00
To: Access
Subject: [access] RE: Combining two tables using Union
Try:
SELECT * From tablename1
UNION ALL
SELECT * From tablename2;
Later,
b.ware
-----Original Message-----
From: Robert Germann [mailto:robert_germann@e...]
Sent: Tuesday, November 19, 2002 3:11 PM
To: Access
Subject: [access] Combining two tables using Union
I would like to combine two tables with exactly the same fields. I was
told to use the union to do this. I looked up in Access Help which says to
do this (Example 1) so I substuded my table names with the example. The
probel I get is for VB to come up with an Compile Error, highlighting the
word "UNION" and say "end of statement". Any suggestions as to why this
does'nt work?
Rob
Example 1:
TABLE tablename1 UNION TABLE tablename2;
Example 2:
TABLE AP3-WRA1_SUBCOMPUTE UNION TABLE AP3-WRA4_SUBCOMPUTE;
Message #7 by "Robert Germann" <robert_germann@e...> on Wed, 20 Nov 2002 15:35:26
|
|
Yes - it Worked - Thanks alot
I agree. I just saw your reply.. he should be ok with either or..
hopefully it helps him out..
b.ware
-----Original Message-----
From: Gerald, Rand [mailto:RGerald@u...]
Sent: Tuesday, November 19, 2002 12:31 PM
To: Access
Subject: [access] RE: Combining two tables using Union
Importance: High
Hi b.ware,
It looks like both of us came up with the same solution except for the
"ALL".
The end user did not indicate how he wanted to handle duplicate records.
Rand E Gerald
Database Specialist
Information Services / Operations
Bahá'í National Office
1233 Central St.
Evanston IL 60201
(xxx) xxx-xxxx
-----Original Message-----
From: bwarehouse [mailto:bwarehouse@y...]
Sent: Tuesday, November 19, 2002 13:00
To: Access
Subject: [access] RE: Combining two tables using Union
Try:
SELECT * From tablename1
UNION ALL
SELECT * From tablename2;
Later,
b.ware
-----Original Message-----
From: Robert Germann [mailto:robert_germann@e...]
Sent: Tuesday, November 19, 2002 3:11 PM
To: Access
Subject: [access] Combining two tables using Union
I would like to combine two tables with exactly the same fields. I was
told to use the union to do this. I looked up in Access Help which says to
do this (Example 1) so I substuded my table names with the example. The
probel I get is for VB to come up with an Compile Error, highlighting the
word "UNION" and say "end of statement". Any suggestions as to why this
does'nt work?
Rob
Example 1:
TABLE tablename1 UNION TABLE tablename2;
Example 2:
TABLE AP3-WRA1_SUBCOMPUTE UNION TABLE AP3-WRA4_SUBCOMPUTE;
|
|
 |