select T2.A, T1.B from T T1, T T2
where T1.B = T2.B group by T2.A, T1.B having count(T2.A)>1
I changed 'where' , before the 'having' the result is same as the old one, but after 'having', the result is totally different. So what's the function of 'HAVING'? I think it just process the data before it, right?