Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
SQL: ORDER BY clause is invalid
Message
From
02/04/2005 04:10:10
 
General information
Forum:
Visual FoxPro
Category:
Other
Environment versions
Visual FoxPro:
VFP 9
OS:
Windows XP SP2
Network:
Novell 5.x
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01000629
Message ID:
01000958
Views:
42
>>>>>
>>>>>What bug are you talking about? Such query works fine in VFP9.
>>>>>OPEN DATABASE (HOME(2) + "Data\testdata")
>>>>>USE testdata!employee
>>>>>SELECT DISTINCT first_name, last_name, ;
>>>>>	home_phone, RIGHT(ALLTRIM(home_phone),4) AS ph ;
>>>>>	FROM employee ;
>>>>>	ORDER BY ph, home_phone
>>>>>
>>>>
>>>>The problem with the code is the "a." preceding the ssn.
>>>>I believe as long as temp is in area "a" it will work.
>>>
>>>Dan,
>>>
>>>There's no 'a.' or ssn in either of above queries.
>>
>>Good, you're back.
>>Someone to talk to.
>>:)
>>
>>I think the problem is that the ssn is a memo.
>>Then I get this error.
>>Make Home_Phone a memo in the above code and try again.
>>
>Dan,
>
>DISTINCT cannot be used with Memo fields. It's documented change in VFP8 (SET ENGINEBEHAVIOR 80).

Sergey, the issue is very simple to understand,
the VFP search ORDER by fieldName on tablesource before to search into the SELECT fields list,
this is the BUG, they do not serve examples, enough to think;
i try to show this to Aleksey, but without happening.

However,A simple example is this:
CREATE CURSOR test (aa m)
SELECT DISTINCT LEFT(AA,1) AS AA FROM TEST ORDER BY 1

SELECT DISTINCT .t. AS AA FROM TEST ORDER BY AA

CREATE CURSOR test (aa m)
SELECT DISTINCT LEFT(AA,1) AS AA FROM TEST ORDER BY 1
* BUG
SELECT DISTINCT LEFT(AA,1) AS AA FROM TEST ORDER BY AA
* if previous has not convinced to you, then
SELECT DISTINCT .T. AS AA FROM TEST ORDER BY AA
* DISTINCT is insignificant
SELECT LEFT(AA,1) AS AA FROM TEST ORDER BY AA
* more simple
SELECT .T. AS AA FROM TEST ORDER BY AA
* if not enough, then not there is hope
Fabio
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform