Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
UNION with Order By
Message
From
30/06/2003 09:18:17
Hilmar Zonneveld
Independent Consultant
Cochabamba, Bolivia
 
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Miscellaneous
Thread ID:
00805248
Message ID:
00805271
Views:
17
I think you must order by number, for instance:
select ...
  union select ...
  order by 3
Where 3 is the third field, in my example.

>I'm doing a Union with 2 identical tables and I'm trying to order be some additional fields that I'm adding. However if I put a variable as the field number to order by I get an error.
>Could someone please help.
>
>lnFields = fcount("DirectAddress")
>
>Select DirectAddress.*, .T. as Direct, nSSC as Code;
>from DirectAddress;
>union select ResidueAddress.*, .F., Residue;
>from ResidueAddress;
>order by Evaluate(lnFields) desc;
>into Cursor AddressOrder nofilter
>
>Thanks in anticipation.
Difference in opinions hath cost many millions of lives: for instance, whether flesh be bread, or bread be flesh; whether whistling be a vice or a virtue; whether it be better to kiss a post, or throw it into the fire... (from Gulliver's Travels)
Previous
Reply
Map
View

Click here to load this message in the networking platform