View Single Post
  #6 (permalink)  
Old January 28th, 2008, 01:51 PM
joefawcett's Avatar
joefawcett joefawcett is offline
Wrox Author
Points: 9,763, Level: 42
Points: 9,763, Level: 42 Points: 9,763, Level: 42 Points: 9,763, Level: 42
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Exeter, , United Kingdom.
Posts: 3,074
Thanks: 1
Thanked 38 Times in 37 Posts
Default

Yes, but the lack of ALL in the UNION would mean duplicates would be eliminated, wouldn't that lead to the same thing?
So if the two tables were:
Code:
JobListTable
job_date    job_number    job_phase    qty_delivered
20080101            1            1            1
20080102            1            1            1
20080103            2            1            1
20080104            3            1            1

SequentialJobListTable
job_date    job_number    job_phase    qty_received
20080101            1            1            1
20080102            2            2            1
20080103            2            1            1
20080101            4            1            1
The UNION version would be:
Code:
job_date    job_number    job_phase    qty_delivered    job_date    job_number    job_phase    qty
20080101            1            1            1        20080101            1            1            1
20080102            1            1            1        NULL            NULL            NULL            NULL
20080103            2            1            1        20080103            2            1            1
20080104            3            1            1        NULL            NULL            NULL            NULL
20080101            1            1            1        20080101            1            1            1
NULL            NULL            NULL        NULL        20080102            2            2            1
20080103            2            1            1        20080103            2            1            1
NULL            NULL            NULL        NULL        20080101            4            1            1
Rows 1 and 5 and 3 and 7 are duplicates so rows 5 and 7 would be removed.

--

Joe (Microsoft MVP - XML)