What you're tring to acomplish? I'm not sure what is your definiton of 'steps' for a query and why it's so importent that there was only one step in a query. Anyway, following query uses correlated subquery.
SELECT * FROM t1 ;
WHERE EffectiveDate IN ( ;
SELECT max(EffectiveDate) ;
from t1 t1_2 ;
where EffectiveDate <= ?dParam ;
AND t1_2.Empid = t1.empid )
>Hi Sergey,
>This is still 2 steps, just combined onto 1 line of code.
>I was really hoping for something that would only "use t1 shared" once during the process.
>This is probably the best that can be done, but I'm still hoping.
>
>
>>This query should work
SELECT * FROM t1 ;
>> WHERE STR(EmpId) + Dtos(EffectiveDate) IN ( ;
>> Select Str(EmpID) + Dtos(max(EffectiveDate)) ;
>> from t1 ;
>> where EffectiveDate <= ?dParam ;
>> group by EmpID )
>>
>>
--sb--