Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Query result not always sorted correctly
Message
From
29/09/2000 14:29:38
Cindy Winegarden
Duke University Medical Center
Durham, North Carolina, United States
 
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00422666
Message ID:
00422783
Views:
11
When you see the grouping on the report going haywire can you stop and see exactly how the SELECT statement has ordered the data? Does the SELECTed CURSOR match what you see on the report? If it does then your problem is definitely in the SELECT statement.

Otherwise, is there a view or something in the report's data environment and you are actually looking at something other than the results of the below SQL?


>I am getting a weird thing happening in one of my. The symptoms are that the grouping of a report goes haywire. In actuality it is the underlying table that is not ordered properly. What is perplexing is that the table is ordered as part of the query. so the table order should always be intact... shouldn't it?
>
>Has anyone ever gotten a query result where it doesn't order the way you told it to? The actual query is below. This query has proven to work time and time again. It only misbehaves intermittently. Note that I order the query result with field numbers instead of field names due to the fact that it is a UNION select statement:
>
>SELECT Bid.orig_entry, Bid.bid_num, Bid.co_code, Bid.bid_sponsr, Bid.job_sponsr, Bid.bid_due, Bid.job_num, ;
> Bid.descrip, Bid.award_due, Bid.origin, Bid.destnation, Bid.bideng_wrk, Bid.budgetary, ;
> Customer.cust_id, Customer.cust_name, 'BID' AS BidorJob, lnCount AS SortGroup ;
> FROM bid INNER JOIN customer ;
> ON Bid.cust_id = Customer.cust_id ;
> WHERE Bid.bid_due >= ldBid_date ;
> AND EMPTY(Bid.job_num) = .T. ;
> AND (Bid.bid_status = "E" OR Bid.bid_status = "P") ;
> AND &lcAnd_clause ;
> UNION;
> SELECT Bid.orig_entry, Bid.bid_num, Bid.co_code, Bid.bid_sponsr, Bid.job_sponsr, Bid.bid_due, Bid.job_num, ;
> Bid.descrip, Bid.award_due, Bid.origin, Bid.destnation, Bid.bideng_wrk, Bid.budgetary, ;
> Customer.cust_id, Customer.cust_name, 'JOB' AS BidorJob, lnCount AS SortGroup ;
> FROM bid INNER JOIN customer ;
> ON Bid.cust_id = Customer.cust_id;
> WHERE Bid.awarded >= ldBid_date;
> AND Bid.job_num > 0;
> AND &lcAnd_clause ;
> ORDER BY 16, 2 ;
> &lcInto_Target
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform