Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Parameters for Order by in SQL?
Message
De
28/08/1998 11:46:25
Cetin Basoz
Engineerica Inc.
Izmir, Turquie
 
 
À
28/08/1998 11:30:44
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Divers
Thread ID:
00131023
Message ID:
00131031
Vues:
68
>I read a tip in July's Foxpro Advisor that you can use paramters for other than the where clause in an SQL view, fox example the Order by (provided you use the numeric construct, e.g. ORDER BY 2, instead of the field name). I couldn't get it to work however (got an error when I included ORDER BY ?testorde after setting testorde to 2 in the command window). Has anyone had any success or attempted this?
>
>I was intrigued by the idea as I'm trying to create an SQL for a report, but my users want to have flexibility in how it is ordered: Alphabetically, by District, or by Category. I don't want to create many different instances of the same SQL for this purpose. Perhaps I'm overlooking something obvious or another way to allow for this flexibility.
>
>I'd appreciate any ideas.
>
>TIA
>
>Sylvia
Sylvia,
I never done it with "?testorde" style but generally use numeric instead of field name (ie: select field1+field2+substr(field3,4,3) as somedata,* order by 1 works but not order by field1+field2+substr(field3,4,3) or somedata). If you would provide testorde just before the SQL then only replacing "?" with "&" would do the job :
testorder="2"
select * from mytable order by &testorder
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
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform