Help with Tables!!!

M

Mr. Capuchino

I have two tables and i want to add the data from one table at the bottom of
the other table. is there an SQL for doing this?
 
D

Douglas J Steele

"at the bottom of" has no real meaning in relational databases. Data goes
wherever the DBMS can fit it. If the order of the records is important, make
sure you have a field that you can use in an ORDER BY clause in your query.
 
J

Jeff Boyce

Are you saying that you want the records in one table added to another
table?

What are you trying to accomplish by doing this? (I ask because there may
be other ways to accomplish what you're seeking.)

Take a look at "append" queries.
 
M

Mr. Capuchino

I have two tables.. Collections and CheckVouchers
What I'm trying to accomplish is that there are fields in each table that
are the same(Collections and CheckVouchers) but the two tables are not
union-compatible. I need to make a query out of these fields so that i can
group the field Payee and their transactions to generate a report.
 
J

John Vinson

I have two tables.. Collections and CheckVouchers
What I'm trying to accomplish is that there are fields in each table that
are the same(Collections and CheckVouchers) but the two tables are not
union-compatible. I need to make a query out of these fields so that i can
group the field Payee and their transactions to generate a report.

You don't need to select *all* the fields for a Union query; if you
just want to union a few of the fields in the two tables, just select
those fields:

SELECT Field1, Field8, Field9 FROM Collections
UNION
SELECT Field3, Field11, Field12 FROM CheckVouchers;

The fact that other fields don't match is irrelevant - all that is
required is that each SELECT includes the same number of fields of
matching datatypes.

John W. Vinson[MVP]
 
Top