whoever wrote that query was missing something very obvious
Code:
select NAME
from MAIN
inner
join A
on MAIN.ID
= A.ID
where NUMBER
in ('number1','number2',...)
group
by NAME
Edit: ooops those were ANDs joining the EXISTs clauses, not ORs
okay, forget the above, use this:
Code:
select NAME
from MAIN
inner
join A as A1
on MAIN.ID = A1.ID
and A1.NUMBER = 'number1'
inner
join A as A2
on MAIN.ID = A2.ID
and A2.NUMBER = 'number2'
...
group
by NAME