Id Study keyword 1 A K1 2 A K2 3 B K1 4 B K2 5 C K1 6 C k3
SELECT DISTINCT Study FROM yourtablename WHERE keyword='K1' AND NOT keyword='K2'
That *should* give you a single entry for 'C' since its keywords do not match both 'K1' *and* 'K2'
But your posting *was* a little confusing, so perhaps you can elaborate a little further on what it is you're trying to accomplish?
-id
-- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]