For a single table access (that returns all values of b
for a specific value of a
on the same line), try:
select a, group_concat(distinct b)
from yourtable
group by a
having count(distinct b) > 1
To return separate rows for each combination of a and b, try:
select distinct yt1.a, yt1.b
from yourtable yt1
join yourtable yt2 on yt1.a = yt2.a and yt1.b <> yt2.b
Exists
variant:
select distinct a, b
from yourtable yt1
where exists
(select 1
from yourtable yt2
where yt1.a = yt2.a and yt1.b <> yt2.b)