You can use this approach:
SELECT DISTINCT id, attribute FROM test t1 WHERE (SELECT count(DISTINCT attribute) FROM test t2 WHERE t2.id = t1.id) = 1
A better approach might be:
SELECT DISTINCT t1.id, t1.attribute FROM test t1, ( SELECT id, count(DISTINCT attribute) COUNT FROM test GROUP BY id HAVING COUNT = 1 ) t2 WHERE t1.id = t2.id
Francisco spaeth
source share