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

OpenCV OpenCL: Convert Mat to Bitmap in JNI Layer for Android -

android - org.xmlpull.v1.XmlPullParserException: expected: START_TAG {http://schemas.xmlsoap.org/soap/envelope/}Envelope -

python - How to remove the Xframe Options header in django? -