Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
SQL help
Message
 
 
To
19/07/2002 13:31:37
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Title:
Miscellaneous
Thread ID:
00680170
Message ID:
00680556
Views:
22
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.
df (was a 10 time MVP)

df FoxPro website
FoxPro Wiki site online, editable knowledgebase
Previous
Reply
Map
View

Click here to load this message in the networking platform