Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Ordering a SQL select by upper(some_column)
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Divers
Thread ID:
00295150
Message ID:
00295160
Vues:
23
>I have the following SQL:
>
>
SELECT pk_contract_id, cDesc  ;
>	FROM Contract ;
>	WHERE UPPER(Contract.cDesc) LIKE 'A%' ;
>	ORDER BY cDesc
>I need the result sorted by upper(cDesc). I can't do ORDER BY upper(cDesc) I found out :(
>
>I had two other ideas.
>1) Add a 3rd column upper(cSort) as cDesc then ORDER BY cSort
>2) index the resulting cursor after the select.
>
>Are those the only ways to accomplish it? I was hoping I could do it all in one shot with the sql.

Maybe not the best way, but it works:

SELECT pk_contract_id, cDesc, UPPER( cDesc ) AS cDescUpper ;
FROM Contract ;
WHERE UPPER(Contract.cDesc) LIKE 'A%' ;
ORDER BY 3
Chris McCandless
Red Sky Software
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform