>I have this table (T1.dbf)
>
>EmpID EffectiveDate Value
>1 {5/6/2} 17
>1 {3/4/2} 18
>1 {1/1/1} 5
>2 {4/5/2} 18
>2 {1/1/1} 6
>3 {4/12/2} 16
>3 {1/1/1} 7
>
>and want to return this for a parameter of {4/8/2}
>
>EmpID EffectiveDate Value
>1 {3/4/2} 18
>2 {4/5/2} 18
>3 {1/1/1} 7
>
>Currently I have to do it in 2 steps.
>
>1 Select EmpID, max(EffectiveDate) as ED
> from t1 ;
> where EffectiveDate <= ?dParam ;
> group by EmpID ;
> into cursor Temp
>2 Select Temp.*, T1.Value ;
> from Temp join T1 on Temp.EmpId + Temp.ED = T1.EmpID + T1.EffectiveDate
>
>Can anyone get it down to 1 step?
What's that good for? Often, the less-steps code is less readable also. And it's often also less fast. Okay, I'll elaborate my second statement: It's not always faster.
Groet,
Peter de Valença
Constructive frustration is the breeding ground of genius.
If there’s no willingness to moderate for the sake of good debate, then I have no willingness to debate at all.
Let's develop superb standards that will end the holy wars.
"There are three types of people: Alphas and Betas", said the beta decisively.
If you find this message rude or offensive or stupid, please take a step away from the keyboard and try to think calmly about an eventual a possible alternative explanation of my message.