Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
SQL : Can I use Select... Order By SUBSTR(xxxxx) ?
Message
De
08/08/1999 10:34:30
Charlie Schreiner
Myers and Stauffer Consulting
Topeka, Kansas, États-Unis
 
 
À
08/08/1999 10:12:18
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00251237
Message ID:
00251241
Vues:
9
>All,
>
>I'm using SQL Select to retrieve data from a few tables where one of the field in the cursor is "month".
>
>Example,
>03/98
>04/98
>06/98
>02/99
>06/99
>
>For that, I need to put the order as,
>ORDER BY SUBSTR(month,4,2),SUBSTR(month,1,2)
>
>However, this cannot be done because ORDER BY need to refer to a field, but not SUBSTR(...).
>Any solution or good idea to this??
>
>Thanks,
>Gan
Try
SELECT SUBSTR(Month,4,2) AS Year, SUBSTR(Month,1,2) AS Month FROM MyTable ORDER BY Year, Month
or if you're happy with EXP_1, EXP_2 as field names
SELECT SUBSTR(Month,4,2), SUBSTR(Month,1,2) FROM MyTable ORDER BY 2,1
Charlie
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform