我正在PostgreSQL中加入两个表。一个表格是我的原始adwords数据(adwords_final。)。第二个表格只是对需要报告的“广告系列”列的引用。这些引用仅在每个广告系列中发生一次,而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 :(得分:0)
FROM 'C:\Users\iantu\Desktop\Performance Marketing\Report
Outputs\adwords_final.csv' DELIMITER ',' CSV HEADER encoding 'windows-1251';
COPY (SELECT DISTINCT * FROM adwords_final LEFT 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;