Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
IIf() in SQL-Select???
Message
 
 
À
22/08/2001 21:33:36
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00547729
Message ID:
00547817
Vues:
8
Hi!


No. Just use 2 different queries. You can also build a function that will reverse in sorting order the resulting value of the SortOrder expression, but this is not an easy task for character expression. For numeric it is just '-Expression'. For strings you require to change each character code in string to its opposite (chr(255-asc(CharCode), or use 128-based). Zip4is probably a number, but what is DP? If it is a number also, your sorting expression will look like following:
Select *, iif(LotOrder="D",-1,1)*val(PADR(IIF(Left(CRRT,1) = "B", Zip4 , DP), 4)) AS Sortorder ;
  From MasterList ;
  Where Zip = "96700" 
  Order By MailStream, Zip, CRRT, SortOrder ;
  Into Table ClientFile 
In other case you will require to use the CHRTRAN() to reverse each character of the character value.

>Thanks it worked great, which lead me to another question regarding the ASC DESC values. I need to also sort ascending if the value in my LotOrder field is "A" and descending if the value in my LotOrder field is "D". Is the fix for this as simple as the last one?
>
>Thanks again for your help.
>
>Aloha,
>
>James
Vlad Grynchyshyn, Project Manager, MCP
vgryn@yahoo.com
ICQ #10709245
The professional level of programmer could be determined by level of stupidity of his/her bugs

It is not appropriate to say that question is "foolish". There could be only foolish answers. Everybody passed period of time when knows nothing about something.
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform