Q:

SQL where 1 column contains in two columns certain data

I have a query like
select * 
from Datatable 
where A in  (select A 
             from(subselect Q) 
  and B in (select B from(subselect Q)

But this won't do like I want.
In my result A and B have to be in the same row, but I can't figure out how to do this.
edit:
Datatable:
KundeVersionID, Zeitpunkt, KundeID
16,             2014-08-05 18:31:10.317,    10;
17,             2013-11-27 16:26:53.980,    11
select * from Datatable
 where (Zeitpunkt  in (select Zeitpunkt from
        (select KundeID, MAX(Zeitpunkt) as Zeitpunkt from KundeVersion 
           group by KundeID)As Q) 
        and KundeID in(select KundeID 
          from (select KundeID,MAX(Zeitpunkt) as Zeitpunkt 
            from KundeVersion group by KundeID)As Q)) order by KundeID

hope this helps

A:

You can make your subquery look like a table in the FROM clause:
select
  * --TODO - proper column list
from
  Datatable dt
    inner join
  (select KundeID, MAX(Zeitpunkt) as Zeitpunkt from KundeVersion 
           group by KundeID) q
    on
       dt.KundeID = q.KundeID and
       dt.Zeitpunkt = q.Zeitpunkt

