SELECT CUSTOMERID FROM CUSTOMER01;
UNION ALL(SELECT CUSTOMERID FROM CUSTOMER02) INTO TABLE ALLCUSTID
>Thanks Sergey -
>Your right - I had the counts wrong. I should know better. Everything is working correctly.
>
>
>>Yes, you're correct. The UNION ALL returns all records including duplicate ones. My guess would be that either you got record counts for tables wrong or there're a lot of deleted records in one or both tables.
>>
>>>I have two customer files. The first contains 6 million records. The second contains 2 million records. I haven't checked yet, but I believe all records have a customer id.
>>>
>>>After running the following select statement, I would expect to have a file of 8 million customer numbers. Instead, the select returns 6.7 million.
>>>
>>>It's my understanding the UNION ALL clause returns all rows spaning multiple tables - regardless of duplications. What am I missing? I haven't had a chance to play around with this yet, but I thought I'd post this in case someone can save me the time. Thanks in advance.
>>
>>>SELECT CustomerID;
>>>FROM Customer01;
>>>INTO TABLE AllCustID;
>>>UNION ALL;
>>>SELECT CustomerID;
>>>FROM Customer02
>>