sql server - T-SQL - query filtering -


table1:

id          customer no_ 7044900804  z0172132 7044900804  z0194585 7044907735  z0172222 7044907735  z0172222 7044910337  z0172216 7044911903  z0117392 

i values same id , different customer no_ table1.

id          customer no_ 7044900804  z0172132 7044900804  z0194585 

i've tried use query finding duplicates, won't filter values same id , same customer no_ table1.

select  id       , [customer no_]   table1 group id, [customer no_] having count(*) > 1 

could me t-sql query solution? advices.

try this

select * table1 id in (     select  id       table1     group id     having count(distinct [customer no_]) > 1 ) 

sql fiddle demo


Comments

Popular posts from this blog

design - Custom Styling Qt Quick Controls -

Unable to remove the www from url on https using .htaccess -