T-SQL重复检查

问题描述 投票:-1回答:1

一段时间以来,我面临这个问题-我有这种选择结果:

col1 col2 col3
5   95.91.232.198   1
8   95.91.232.198   1
9   95.91.222.206   5
152 95.91.222.206   1
25  95.91.204.108   5
5   95.91.204.108   5
  • column3只能有2个值:1或5

我只想在具有重复IP的column3中选择那些具有不同编号的行-示例(应选择的内容:]]

this should be selected
    127.0.0.1   1
    127.0.0.1   5

而这不是

127.0.0.1   1
127.0.0.1   1

希望我自己已经很好地解释了。感谢您的帮助

从一段时间以来我正面临这个问题-我有这种选择结果:col1 col2 col3 5 95.91.232.198 1 8 95.91.232.198 1 9 95.91.222.206 5 152 95.91.222.206 1 25 95.91.204.108 ...

sql-server tsql duplicates partitioning
1个回答
0
投票

使用EXISTS

© www.soinside.com 2019 - 2024. All rights reserved.