Combining Two Tables

  • Thread starter Thread starter Noah
  • Start date Start date
N

Noah

I have two tables that I would like to combine into one
table.

Here is kind of what the tables look like:
TABLE1 TABLE2
Date Info Date Info
20040202 abd 20040202 abd
20040225 fgh 20040225 fgh
20040302 iop 20040401 qwe
20040401 qwe

Some of the date fields on the two tables match and some
don't.

I would like the query that creates the new table to bring
back everything where the dates match and everything where
they don't. If the dates don't match I would like a space
in the field that is missing. So it will look like this:

NEW_TABLE
Date1 Info1 Date2 Info2
20040202 abd 20040202 abd
20040225 fgh 20040225 fgh
20040302 iop
20040401 qwe 20040401 qwe

You can see the space where the dates don't match.

Any help would be great. Thanks!
 
Are the Info fields unique? If not, how will the system know which records
to combine?

--
Rebecca Riordan, MVP

Designing Relational Database Systems
Microsoft SQL Server 2000 Programming Step by Step
Microsoft ADO.NET Step by Step

http://www.microsoft.com/mspress

Blessed are they who can laugh at themselves,
for they shall never cease to be amused...
 
Back
Top