2012-09-19 121 views
0

我在臨時環境創建包含重複記錄的表?

SQL> SELECT COUNT(*) 
    2 FROM MASTER_CHILD_MERGE A 
    3 WHERE A.CAM_ID IN (SELECT B.CAM_ID FROM CAM_DIM B); 
SQL> 703022 

對於我們的團隊分析師識別重複的記錄,我想創建一個具有A和B的列的表。我試過這樣做

SQL> CREATE TABLE DUPES AS 
    2 SELECT * FROM NDS_MASTER_CHILD_MERGE A 
    3 WHERE A.CAM_ID IN (SELECT B.CAM_ID FROM CAM_DIM B); 

但我意識到它只會給我A的列。我如何添加B的列?我很確定這是一個明顯的解決方案,但我沒有看到它......

我在Oracle 10g上。

回答

1

剛剛加入這兩個表的

create table dupes as 
    select * 
    from nds_master_child_merge a 
    join cam_dim b 
    on a.can_id = b.cam_id 
+0

天哪。謝謝。接受並投票決定。 – Chris

0
SELECT A.*, B.* INTO DUPES 
FROM NDS_MASTER_CHILD_MERGE AS A INNER JOIN CAM_DIM AS B ON A.CAM_ID = B.CAM_ID