Merging recordsets

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

Guest

If I have 2 recordsets, both which contain identical fields, is it possible
to merge them into 1, before displaying them on a report?

Thanks,

-David
 
When you say recordset, I assume you mean Queries or Tables, after all
RecordSet are set from Table/Query.
Yes, you can by using Union query

Select * From Table1 Union
Select * From Table2
 
If I have 2 recordsets, both which contain identical fields, is it possible
to merge them into 1, before displaying them on a report?

Thanks,

-David

If they are stored as tables, or if you have Queries which return
them, then a UNION query would do the trick. If not... how are you
generating the recordsets?

John W. Vinson[MVP]
 
David,

If your two "recordsets" are actually tables with identical structures, but
slightly different information, I would suggest that you need to normalize
your database by permanently merging the two tables, and adding an
additional field that will describe that property that is currently defined
by the tablename.

Dale
 
Yes, a bit more info. 2 tables, each with a prodId column. When I query:
Select prodId from Table1 union
Select prodId from Table2;

It returns a "distinct" set of results. How would I get it to return all of
the rows, instead of removing the duplicates. Essentially, I have a many to
many relationship in the case of product ID, where the same product ID might
have 2 or more rows in either table based on a serial number.

Thanks,

-David
 
It returns a "distinct" set of results. How would I get it to return all of
the rows, instead of removing the duplicates.

Use

UNION ALL

instead of

UNION

John W. Vinson[MVP]
 
Hi. ( this Microsoft forum is really great to microsoft users.)

I'm having the same problem. I have an access database linked to other
program. The other program has two similar table, not to say equal. One table
has the history register and he other has the current registers. Well, the
current table has only the current month reguisters the history table has the
others. I need to build a querie that merge both tables in a chronological
order.

I try with that Union All but for some reason intead of appearing two
registers of one day, it appears several register/recordset form the same day.

Thanks,
Marco
 
Back
Top