Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Sub queries or separate SELECTs?
Message
From
24/09/2005 17:10:07
 
 
To
23/09/2005 19:07:09
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Environment versions
Visual FoxPro:
VFP 9
OS:
Windows XP SP2
Network:
Windows XP
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01052615
Message ID:
01052799
Views:
7
>Hi,
>
>Is there a speed advantage to using separate SELECT commands as opposed to humping them up into a single command using sub queries?
>
>Here's an example of what I'm refering to:
>
>SELECT Field1,CNT(*) as nTotal FROM ATable INTO CURSOR crsCursor1 GROUP BY Field1
>
>SELECT nTotal FROM crsCursor1 INTO CURSOR crsCursor2
>
>
>as opposed to
>
>
>SELECT nTotal FROM (SELECT Field1,CNT(*) as nTotal FROM ATable GROUP BY Field1) INTO CURSOR crsCursor2
>
>
>The first example is more of a pain to clean up after but is easier to debug. I'm just wondering if there is a runtime speed advantage to any of them.
>
>Aloha,

Hi James,

I believe the following query will give you the result you want:
SELECT CNT(*) as nTotal FROM ATable GROUP BY Field1 INTO CURSOR crsCursor2 
Thanks,
Aleksey.
>
>James
Previous
Reply
Map
View

Click here to load this message in the networking platform