Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Sub queries or separate SELECTs?
Message
From
27/09/2005 19:19:04
 
 
To
24/09/2005 21:57:07
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:
01053701
Views:
8
As far as I know, VFP does support that kind of query.

The actual code I'm working with is a little more complex than the example I provided. I just stripped down the example code to get the point across with as simple an example as I could think of.

Aloha,

James

>I've got little to add about multiple queries being faster. I'm just curious about the particular example you posted. In the older dialects of VPF in which I work, the query
>
SELECT CNT(*) as nTotal FROM ATable INTO CURSOR crsCursor2 GROUP BY Field1
gives the same result as your 2nd example (unless I've missed even more than I usually do).
>
>Do later versions of VFP not support GROUP BY queries that don't include the aggregating fields in the query itself?
>
>
>
>
>>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,
>>
>>James
Previous
Reply
Map
View

Click here to load this message in the networking platform