Merging "almost"similar tables

noccy

Registered User.
Local time
Today, 16:01
Joined
Aug 19, 2003
Messages
67
Hello!

I have two tables

Table1[Date,Time,SenderID,SenderName,ReceiverID,Re
ceiverName,Type,Direction,Location]

Table2[Date,Time,SenderID,ReceiverID,Type,Directio
n,Code,Reference]

How can I merge theese two tables into one table/query with all the coulumns included like:

MergedTable[Date,Time,SenderID,SenderName,Receiver
ID,ReceiverName,Type,Direction,Location,Code,Refer
ence]


noccy
 
The question is
Why have you got two tables so similar ?. Normalisation rules would remove this duplication.

Suggest that you actually need to normalise your data.

Len B
 
Well...I have to import data into the database, and the data come from two different sources. So the "initial" structure of the data is already given....

noccy
 
Use a Union query and supply Nulls for fields that do not exist in a table:-

Select Date, Time, SenderID, SenderName, ReceiverID, ReceiverName,
Type, Direction, Location, Null as Code, Null as Reference
from Table1
UNION
Select Date, Time,SenderID, Null as SenderName, ReceiverID, Null as ReceiverName,
Type, Direction, Null as Location, Code, Reference
from Table2;
 
That solved I problem I'd been working on, too. Thanks!
 

Users who are viewing this thread

Back
Top Bottom