How do you choose inside a table like below all objects which have a-A and b-B (as key-value pair)?

Something similar to:

SELECT DISTINCT(OBJECT) 
  FROM MYTABLE 
 WHERE key = 'a' 
   AND value = 'A' 
   AND key = 'b' 
   AND value = 'B'

...in which the result could be one and three.

I understand this SQL statement does not work, however i hope it describes a little what I wish to do.

And sorry for that diffuse title. I merely don't understand how to describe the issue better.

object | key | value
---------------------
1   |  a  |   A
1   |  b  |   B
1   |  c  |   C
2   |  a  |   F
2   |  b  |   B
3   |  a  |   A
3   |  b  |   B
3   |  d  |   D
select * 
from mytable 
where (key = a and value = a)
or    (key = b and value = b)

or

select * 
from mytable 
where key = a and value = a
union
select * 
from mytable 
where key = b and value = b

or even more generally possibly

select * 
from mytable 
where key = value
and key in (a,b)

I believe you would like something of the form:

SELECT a.object 
FROM mytable a, mytable b 
WHERE a.object = b.object 
  AND a.key = 'a' AND a.value = 'A'
  AND b.key = 'b' AND b.value = 'B'

You may also do this

declare @t table(object int, keys varchar(10), value varchar(10))
insert into @t 
    select 1,'a','A' union all  select 1,'b','B' union all
            select 1,'c','C' union all  
    select 2,'a','F' union all  select 2,'b','B' union all
    select 3,'a','A' union all  select 3,'b','B' union all
            select 3,'d','D'
--select * from @t 

Query

select object from @t 
where keys = 'a' and value ='A' 
or  keys = 'b'  and value ='B' 
group by object 
having COUNT(object)>1

Output:

object
1
3