I want to select all “names” from the table which appear more than once and in which the field is not the same. In the above example, I should get one result back - the name “test123”. How would I do that?
Awesome. Thank you both. I was originally trying to write something like what K. Wolfe posted, but it looks like r937’s is cleaner. I always forget about using DISTINCT within the function like that.
One further question - is there a better way to select all “names” and “fields” from this result set, other than doing this:
SELECT t2.name, t2.field
FROM (
SELECT name
FROM daTable
GROUP
BY name
HAVING COUNT(DISTINCT field) > 1
) AS t1
LEFT JOIN daTable AS t2 ON t1.name = t2.name