sfk
sfk

Reputation: 3

c# Finding similar values in the database

I created an access database and connected to C# code. In the database, I have 2 columns (ip and port). My question is how to find the same IP that connects to different value of port column. With other words, I want to search if the same IP connects to many different ports. Any idea?!!

Thank you

Upvotes: 0

Views: 64

Answers (2)

Osama Shabbir
Osama Shabbir

Reputation: 99

SELECT ip FROM tableName GROUP BY ip HAVING COUNT(distinct port) > 1;

Upvotes: 0

Denis Fedak
Denis Fedak

Reputation: 171

SELECT ip FROM tablename GROUP BY ip HAVING COUNT(distinct port) > 1;

Upvotes: 1

Related Questions