Hi,
I want to eliminate duplicate entries from different tables into a single
new table and keep the reference from the original data.
Example:
Table1: toto, titi
Table2: toto, titi, tutu
Table3: tutu, tata
the new table will contain:
NewTable: toto, titi, tutu, tata
and i want to keep a reference that allows to retrieve that toto comes from
Table1 and Table2
tutu comes from Table2 and Table3...
if someone can help me it would be great.
Thanks.
Beter than a single new table, You can make a View
UNION will eliminate duplicate data.
SELECT Field FROM Table1
UNION
SELECT Field FROM Table2
UNION
SELECT Field FROM Table3
To know where 'toto' come from:
SELECT TableName FROM
(
SELECT 'Table1' AS TableName, Field FROM Table1
UNION
SELECT 'Table2' AS TableName, Field FROM Table2
UNION
SELECT 'Table3' AS TableName, Field FROM Table3
) Tmp
WHERE Field='toto'
Laurent.
<Christophe> wrote in message news:OVqTbQGLEHA.1192@.TK2MSFTNGP11.phx.gbl...
> Hi,
> I want to eliminate duplicate entries from different tables into a single
> new table and keep the reference from the original data.
> Example:
> Table1: toto, titi
> Table2: toto, titi, tutu
> Table3: tutu, tata
> the new table will contain:
> NewTable: toto, titi, tutu, tata
> and i want to keep a reference that allows to retrieve that toto comes
from
> Table1 and Table2
> tutu comes from Table2 and Table3...
> if someone can help me it would be great.
> Thanks.
>
No comments:
Post a Comment