内连接的输出重复

时间:2017-07-10 15:46:52

标签: postgresql

我通过内部联接将PostgreSQL中的两个表汇集在一起​​。第一个表格是导出的adwords文件(adwords_final。)。第二个表格只是对"广告系列的引用"要在Microsoft Excel中显示的列。这些广告系列仅在每个广告系列中发生一次,而adwords数据包含每个广告系列的多个条目,因为存在日期因素/列。

我使用以下查询将其输出到csv文件

COPY (SELECT * FROM adwords_final INNER JOIN mk_kw ON "mk_kw"."Key"  =  "adwords_final"."Key") TO 'C:\Users\iantu\Desktop\Performance Marketing\Report Outputs\adwords_final.csv' WITH CSV HEADER;

问题是我的新csv文件包含许多重复项。我在这里使用正确的命令还是应该转换为循环?

来自adwords_final的列

 Week, Keyword state,   Keyword Campaign,    Ad group ,   Status , Max. CPC  ,  Impressions, Interactions ,   Interaction Types ,  Interaction Rate    Avg. Cost ,  Cost  ,  Clicks ,Avg. position ,  Conversions, Quality score ,  Ad relevance  ,  Landing page experience ,Expected clickthrough rate , Qual. score (hist.) ,Ad relevance (hist.)   , Landing page experience (hist.) ,Expected clickthrough rate (hist.)  ,Search Impr. share  ,Match type , First position CPC , Top of page CPC ,First page CPC , Impressions with average ctr    ,Impressions with above average ctr , Impressions with below average ctr  ,Impressions with below average lp exp ,  Impressions with average lp exp ,Impressions with above average lp exp ,  Impressions with below average Ad Rel ,  Impressions with  average ad rel  ,  Impressions with above average ad rel ,  QSxIMP , Key

来自mk_kw的列

Language,   Network, Main Keyword,    Cluster Keyword 1 ,  Match Type,  Key

由于

0 个答案:

没有答案