Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How To Do This SQL
Message
From
05/10/2005 07:26:44
Cetin Basoz
Engineerica Inc.
Izmir, Turkey
 
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Miscellaneous
Thread ID:
01055122
Message ID:
01056191
Views:
22
You have necessary indexes? If yes why need a join in the first place?
*Flock('commits')
DELETE ;
  FROM Commits;
  where seek(Commits.DtId,cAlias,'DtIdTagName')

*or
DELETE for seek(Commits.DtId,cAlias,'DtIdTagName') in 'Commits'
Cetin

>Sergey,
>
>I'm having a problem with these 2 commands. The first takes 29 seconds to
>run against 849,000 records on the local PC, and the second takes 40 seconds.
>
>cAlias contains the name of a temp table, created on the fly in the query
>routine. There is an index on DtId. Since this will be running on network data, and
>is called when the user clicks Save, they are entirely too fast.
>
>I'm tring to remove thse records before they are re-saved. Any ideas on hwo to
>do this faster?
>
>
>DELETE Commits;
>  FROM Commits;
>  JOIN &cAlias ON &cAlias..DtId = Commits.DtId
>
>DELETE FROM Commits;
> WHERE DtId IN;
> (SELECT DtId FROM &cAlias)
>
>
>
>
>
>
>
>
>
>
>
>
>>In addition, you can combine the first select with DELETE/UPDATE
DELETE MyTable ;
>>	FROM MyTable ;
>>	JOIN (SELECT Id FROM MyTable WHERE SomeValue = 1) MyCursor
>>		ON MyCursor.Id = MyTable.Id
>>
>>
>>>Thank you!
>>>
>>>>In VFP9 only
>>>>DELETE MyTable;
>>>>    FROM MyTable;
>>>>    JOIN MyCursor ON MyCursor.Id = MyTable.Id
>>>>
>>>>UPDATE MyTable;
>>>>    SET SomeField = SomeValue;
>>>>    FROM MyTable;
>>>>    JOIN MyCursor ON MyCursor.Id = MyTable.Id
>>>>
>>>>
Çetin Basöz

The way to Go
Flutter - For mobile, web and desktop.
World's most advanced open source relational database.
.Net for foxheads - Blog (main)
FoxSharp - Blog (mirror)
Welcome to FoxyClasses

LinqPad - C#,VB,F#,SQL,eSQL ... scratchpad
Previous
Reply
Map
View

Click here to load this message in the networking platform