Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Select Distinct
Message
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Title:
Miscellaneous
Thread ID:
00779949
Message ID:
00779966
Views:
11
>Is there a way to Select...Distinct from a table and have the resulting records be un-ordered, or following the natural order of the source table? I have tried select ... Distinct and also Select...Group By and the results are always sorted.
>
>TIA,
Jeff,

When you don't specify ORDER BY clause VFP is free to return records in any order. You should not relay on the order of records returned in this case. Here's how you can specify the order you want.
SELECT *, RECNO() AS RecordNo ;
  FROM mytable ;
  INTO CURSOR crsNumbered
SELECT DISTINCT ... ;
  FROM crsNumbered ;
  ORDER BY RecordNo
--sb--
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform