Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Selects order by mixing things up?
Message
 
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Environment versions
Visual FoxPro:
VFP 6 SP5
OS:
Windows 2000 SP4
Database:
Visual FoxPro
Miscellaneous
Thread ID:
00996335
Message ID:
00996339
Views:
13
In general, you cannot expect a physical order of the records to be preserved in the result set. You've to supply a proper ORDER BY clause to get result of a query in any particular order.

>bit of an issue with data order guys, hoping you could help out.
>
>I'm selecting from one table where a value is in annother, all seems well, I then select with an order by to another table and in 4 places in a dbf of over 100k it has jigged the records around a bit, not so that the order by is wrong but just within the groups of records that have the same order number. I was under the impression that the result data would be in the sequence of the original just minus those that dont match. however just occasionally it mixes a few up.
>
>is this standard or an issue? I know I could always add an overall sequencial number and add a second parameter to the order by but I didn't think it was needed.
>
>ok so an eg.
>
>
>order  id
>1      1
>2      1
>3      3
>4      2
>5      3
>6      2
>
>
>I decide to do a
select * from table into sorttable order by id
and I'd expect the new order sequence to be 1,2,4,6,3,5 and 99% of the time it is, thats why I thought it worked that way, but just sometimes I'll get a 1,2,6,4,3,5 I'm talking about a few occurances in a hundred thousand. is it just me being silly to assume? like I said I can always make it
select * from table into sorttable order by id,order
but would like to knowwhy this happens at all.
>
>cheers in advance.
>
>Ken.
--sb--
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform