如何删除重复的列? [英] how to remove duplicate columns?

查看:70
本文介绍了如何删除重复的列?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


hi,在此表中






































shop_code product_id v1 shop_code product_id v2
1 11 1 1 11 4
1 12 2 1 12 5
1 13 3 1 13 6


组列是shop_code + product_id


但表中的这些列在v1和v2列之前出现两次


如何重新移动重复列并只留下一个唯一列


IE输出






























shop_code product_id v1 v2
1 11 1 4
1 12 2 5
1 13 3 6



so sho_code + product_id出现一次。

解决方案

请将您的表格DDL和示例数据发布到脚本中,并将您的预期结果发布到你的样本。感谢。

hi, in this table

shop_code product_id v1 shop_code product_id v2
1 11 1 1 11 4
1 12 2 1 12 5
1 13 3 1 13 6

group columns are shop_code+product_id

but these column in table occurs two times before v1 and v2 column

how to remove duplicate columns and left only one unique column

I.E output

shop_code product_id v1 v2
1 11 1 4
1 12 2 5
1 13 3 6

so sho_code+product_id occure one time.

解决方案

Please post your table DDL and sample data in scripts and your expected result from your sample. Thanks.


这篇关于如何删除重复的列?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆