Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How to use this UNION clause
Message
 
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Environment versions
Visual FoxPro:
VFP 9
Miscellaneous
Thread ID:
01072129
Message ID:
01072132
Views:
17
>>The UNION select can have only one ORDER BY and it's applied to the result set. Try
SELECT * FROM ;
>>	( select TOP 50 * FROM MYTABLE ;
>>		WHERE (&cFilter.) and MY_PK < nPk ;
>>		order by PK ;
>>	) dt1 ;	
>>UNION ALL ;
>>SELECT * FROM ;
>>	(select TOP 50 * FROM MYTABLE ;
>>		WHERE (&cFilter.) and MY_PK > nPk ;
>>		order by PK DESC ;
>>	) dt2
>>
>
>Sergey,
>
>Thank you very much for explanation and for the code.

Also you put DESC in the wrong query's ORDER BY.
--sb--
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform