[AccessD] Combine two tables

Arthur Fuller fuller.artful at gmail.com
Sat Jan 19 09:39:46 CST 2008


The simplest way to do this is to embed the table name as a literal in both
queries:

SELECT CustomerID, CustomerName, "Table1" FROM somewhere
UNION
SELECT CustomerID, CustomerName, "Table2" FROM somewhere

hth,
Arthur

On 1/19/08, Susan Harkins <ssharkins at gmail.com> wrote:
>
> Lembit, the duplicate id values aren't really the problem, right? You need
> to identify the source table -- is this correct?
>
> Susan H.
>
>
> > Hi, everybody,
> >
> > In an Access 2002  I have two linked tables,
> > table A is in the BE which belongs to this FE,
> > table B is in a different database, and it is used there as well.
> > Both tables are lists of persons with id, lastname, firstname, and other
> > fields.
> >
> > I want to use names from both tables as customers.
> > I have made a union query, but this gives me duplicate id numbers.
> >
> > Is there a way to insert the source table name into the union query,
> > so that I can then distinguish from which table a certain record is?
> >
> > Or is there a better solution?
> >
> > Thank you
> > Lembit
> >
> > --
> > AccessD mailing list
> > AccessD at databaseadvisors.com
> > http://databaseadvisors.com/mailman/listinfo/accessd
> > Website: http://www.databaseadvisors.com
>
> --
> AccessD mailing list
> AccessD at databaseadvisors.com
> http://databaseadvisors.com/mailman/listinfo/accessd
> Website: http://www.databaseadvisors.com
>



More information about the AccessD mailing list