Bill,
>You mention using "AND" in the join to possibly replace a WHERE clause.
>Could I use "AND" in the join to get rid of the HAVING clause in the 1st SQL?
>
>>>>select guests.*, commissions.effdate, commissions.commission, ;
>>>> ( guests.date - commissions.effdate ) as delta ;
>>>> from commissions ;
>>>> inner join guests ;
>>>> on commissions.emp = guests.emp ;
>>>> into cursor x1 ;
>>>> having delta > 0
>
>select guests.*, commissions.effdate, commissions.commission, ;
> ( guests.date - commissions.effdate ) as delta ;
> from commissions ;
> inner join guests ;
> on commissions.emp = guests.emp ;
> AND guests.date >= commissions.effdate ;
> into cursor x1
>
HAVING is needed when using an aggregate function, because that field doesn't exist until the SQL runs.
You could do the date compare in the join. There's always alternate ways of doing code.
>>>>I'd almost bet though that without the indexes prebuilt VFP is going to build the temp indexes if it thinks it'll help.
>
>Do I understand this correctly? VFP will see that the tables in the FROM clause are temporary tables and AUTOMATICALLY build temp indexes for the SQL?
Yes, if you've ever noticed a significant lag before the SQL progress bar starts, VFP is building temp indexes during that time.