Select user with user agent like '%MSIE 6.%'
who do not have any other user agent. The inner query returns users who have not used '%MSIE 6.%'
select distinct tb1.UID from TABLE1 tb1
where tb1.UserAgent like '%MSIE 6.%' and
NOT EXISTS ( select tb2.UID from TABLE1 tb2
where tb1.UID = tb2.UID AND
tb2.UserAgent not like '%MSIE 6.%' )
You can even use NOT IN
instead of NOT EXISTS
like tb1.UID NOT IN (...)
.
select distinct tb1.UID from TABLE1 tb1
where tb1.UserAgent like '%MSIE 6.%' and
tb1.UID NOT IN ( select tb2.UID from TABLE1 tb2
where tb2.UserAgent not like '%MSIE 6.%' )
The where clause condition tb1.UserAgent like '%MSIE 6.%' and
can also be dropped without any side effects as the NOT
and the inner query makes sure that the user's agent matches %MSIE 6.%