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
Environment versions
Visual FoxPro:
VFP 9 SP1
Miscellaneous
Thread ID:
01308521
Message ID:
01308958
Views:
13
Naiomi,

Appoplogies I chopped about the example SQL and missed out a couple of rather relevent lines, should have been:
* Move to Previous record
cSQL =	"SELECT TOP 1 * FROM "_
		& "(SELECT TOP 1 *  FROM Master WHERE " _
		& "Id < '" & cLastId & "' " _
		& "ORDER BY Id DESC) curMaster "_
	& "UNION ALL "_
	& "SELECT * FROM "_
		& "(SELECT TOP 1 * FROM Archive WHERE " _
		& "Id < '" & cLastId & "' " _
		& "ORDER BY Id DESC) curArchive "_
	& "ORDER BY Id DESC"
All the best,
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform