Help with Tables!!!

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

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?
 
"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.
 
Mr. Capuchino said:
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?

Tables don't really have orders. The are more like buckets of data than
list.

If you want to keep data in a specific order, you really need a filed or
group of fields that can be sorted to that order. (Note: autonumbers are
not guaranteed to provide consecutive or consistent order.)
 
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.
 
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.
 
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]
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top