Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
SQL: ORDER BY clause is invalid
Message
De
04/04/2005 13:07:58
 
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Versions des environnements
Visual FoxPro:
VFP 9
OS:
Windows XP SP2
Network:
Novell 5.x
Database:
Visual FoxPro
Divers
Thread ID:
01000629
Message ID:
01001274
Vues:
20
>Dan,
>
>>Does work in 8.
>
>No, it doesn't error. It doesn't produce a correct result. Consider this alternate example:
>
>
create cursor x1 ( firstname c(10) )
>insert into x1 values ( "Dave" )
>insert into x1 values ( "Abe" )
>insert into x1 values ( "Albert" )
>select distinct substr( firstname, 2, 5 ) as firstname ;
>   from x1 ;
>   into cursor x2 ;
>   order by firstname
>
>
>The output order is not what you think it is. Your ssno only sort of produces acceptable ordering because of the left(), but it doesn't work in the more general case.
>
>>Does work in MS SQL ( with a few changes :) ).
>
>What? Notable changes like SQL won't allow you to use the output column names in the ORDER BY clause in the first place? *g*

Sure?

Run this into MS SQL,it is ok:
create TABLE #x1 ( firstname cHAR(10) )
insert into #x1 values ( 'Dave' )
insert into #x1 values ( 'Abe' )
insert into #x1 values ( 'Albert' )
select distinct substrING( firstname, 2, 5 ) as firstname
   from #x1 
   order by firstname -- this is the output column Name

DROP TABLE #X1
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform