Link to home
Start Free TrialLog in
Avatar of sam2929
sam2929

asked on

finding different address based on same id

i Have

ID    ADDR
1001  'AAA'
1001  'BBB'

1002   'BBB'
1003   'CCC'
1002   'BBB'

how can i find how many same ID has different ADDR OUPUT

ID    ADDR
1001  'AAA'
1001  'BBB'
Avatar of ralmada
ralmada
Flag of Canada image

see if this works for you

select * from yourtable
where id in (select id from yourtable group by id having count(distinct addr) > 1)
ASKER CERTIFIED SOLUTION
Avatar of ralmada
ralmada
Flag of Canada image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial