sql server - sql help to find out multiple entries -


i have table t1 values

col1 col2  1     2 1     4 1     4 2     4 2     4 3     5 3     5 4     3 4     3 5     1 5     1 5     6 5     6 

i need output

1     2 1     4 5     1  5     6 

that when col2 has multiple entries interested in records only.

any help?

one way of doing it:

select col1, col2  t1 col1 in (select col1 t1 group col1 having count(distinct col2) > 1) group col1, col2 

the query should pretty self-explanatory.


Comments

Popular posts from this blog

java - Solr query version issue: Invalid version or the data in not in 'javabin' format -

Hard vs. Soft Water: What's The Difference?

The Ten Most Livable Cities In The World