Das suchte ich ..

PHP-Code:
with a as (                                        
  
select FF1ff2ff3,                            
         
min(fjj*10000+fmm*100+ftt) as mi         
    from datei1                                    
   where 
(ff1ff2ff3in(                       
      
select f1f2f3                            
        from datei2                                
       where hdkz 
10              )              
   
group by f1f2f3),                           
     
as (select ff1ff2ff3,                   
     
min(fjj), min(fmm), min(ftt), min(fnr) as fnr
             from datei1 where                     
             
(ff1ff2ff3,                       
             
fjj*10000+fmm*100+fttin(            
  
select  ff1ff2ff3mi from a)                
group by ff1ff2ff3)                            
select from b