Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Using expression in ORDER BY clause
Message
De
18/10/2001 13:40:44
Cetin Basoz
Engineerica Inc.
Izmir, Turquie
 
 
À
18/10/2001 13:33:32
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00570371
Message ID:
00570397
Vues:
17
>>>From VFP 7 help:
>>>
>>>Each Order_Item must correspond to a column in the query results and can be one of the following:
>>>...
>>>A numeric expression indicating the location of the column in the result table.
>>>
>>>However, the following program causes error
>>>
>>>SQL: Column 'NORDER' is not found.
>>>
>>>How to use expressions in ORDER BY clause ?
>>>
>>>
>>>norder = 1
>>>CREATE CURSOR test ( test c(1) )
>>>SELECT * from test ORDER BY (norder)
>>>
>>
>>SELECT * from test ORDER BY norder
>
>This causes the same error !!!
>
>
>PRIVATE norder
>norder = 1
>CREATE CURSOR test ( test c(1) )
>SELECT * from test ORDER BY norder
>
Andrus,
In my original reply I was a little bit ignorant and sampled in next. Yes it would error becaues there VFP 'thinks' it's a column name.

norder = '1'
SELECT * from test ORDER BY &norder

or :
SELECT * from test ORDER BY 1

Would work. In real life I used & with order by only when I needed to provide somthing like ad-hoc query. Other than that I directly write numerics.
Cetin
Çetin Basöz

The way to Go
Flutter - For mobile, web and desktop.
World's most advanced open source relational database.
.Net for foxheads - Blog (main)
FoxSharp - Blog (mirror)
Welcome to FoxyClasses

LinqPad - C#,VB,F#,SQL,eSQL ... scratchpad
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform