我把表a中的数据作为i/p
Col A | Col B | Col C
PG_1100000357_1100000356 | 1100000357 | 1100000356
PG_1100000356_1100000357 | 1100000356 | 1100000357
PG_10909099_12990909 | 10909099 | 12990909
PG_8989898_79797987 | 8989898 | 79797987
PG_8989898_79797987 | 8989898 | 79797987
我需要写一个查询来接收订单-
1) 当i/p与另一条记录匹配时,从i/p中删除完全相同的副本(示例4和5记录)2)我们需要考虑 COl B
, COl C
连接 Col c
, Col B
把那个复制品也去掉(第一和第二记录)注:- COl A
是通过联系方式到达的(第二页,b栏,“,”c栏),不用担心
Col A | Col B | Col C
PG_1100000357_1100000356 | 1100000357 | 1100000356
PG_10909099_12990909 | 10909099 | 12990909
PG_8989898_79797987 | 8989898 | 79797987
你能帮帮我吗?非常感谢。
3条答案
按热度按时间ldxq2e6h1#
下面的sql查询按预期返回结果
js81xvg62#
gjmwrych3#
在多个列中保存相同的数据是不对的。价值观
Col_B
以及Col_C
已经存在于Col_A
,只需将它们拆分,然后使用least
以及greatest
功能如@akk0rd87所建议,并考虑到前面的标签oracle
:演示