Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Help with Order By in a Union
Message
 
 
To
04/05/2009 00:47:13
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Miscellaneous
Thread ID:
01397707
Message ID:
01397741
Views:
52
>>Try with
>>
>>...
>>ORDER BY 1
>>
>
>Yep, that does it. I had tried that already today, with no luck...But, when you suggested it, I went back and tried some more things:
>
>You see, the case is tricky because I must eval it since the user may have chosen to sort by another column. There are actually more columns than what I showed in my example code. I just posted a simpler version to make it easy to see the problem.
>
>It's pretty much all eval'd. (See code below.)
>
>Any way, when I tried earlier, I had set the Form property that controls this to '1', which did not work, but I finally realized that I had to enter ='1' into the Property Sheet, then it started working!
>
>Here is the actual code, where you can see all the evals:
>
>
>   *-- Pull template structure and then local child records 
>   Select * From &lcTemplate where 1=2 Into cursor &lcDiskFile; && Just gets the structure, no records
>    Union All;
>     Select &lcCopyFlds;
>      From &lcChildAlias with (BUFFERING=.T.);
>      Where &lcCriteria;
>      Order By &lcChildOrderField
>
If this is the case, you need to use your unordered select as derived table, e.g.

select * from (mySelect with union) Derv order by &lcChildOrderField
If it's not broken, fix it until it is.


My Blog
Previous
Reply
Map
View

Click here to load this message in the networking platform