Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Optimizing SQL UNION
Message
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Title:
Optimizing SQL UNION
Environment versions
Visual FoxPro:
VFP 9 SP1
Miscellaneous
Thread ID:
01308521
Message ID:
01308521
Views:
53
Any suggestions or clues how I might optimize this SQL, it is running via ADO?

lcPreviousId = ThisRecord.Id

* Previous record:
SELECT * FROM Master WHERE (Id < lcPreviousId) UNION ;
SELECT * FROM Archive WHERE (Id < lcPreviousId) ;
ORDER BY Id DESC

* Next record:
SELECT * FROM Master WHERE (Id > lcPreviousId) UNION ;
SELECT * FROM Archive WHERE (Id > lcPreviousId) ;
ORDER BY Id ASC

Thsnks,
Nick
Next
Reply
Map
View

Click here to load this message in the networking platform