Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
IIf() in SQL-Select???
Message
From
23/08/2001 09:16:10
Hilmar Zonneveld
Independent Consultant
Cochabamba, Bolivia
 
 
To
22/08/2001 21:33:36
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00547729
Message ID:
00547886
Views:
15
>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

Apart from having separate SELECT - SQL statements, you can also use macro substitution.
lcOrderBy = iif(OrderByField = "D", "DESCENDING", "ASCENDING")
select ...
  order by MyField &lcOrderBy
  ...
HTH, Hilmar.
Difference in opinions hath cost many millions of lives: for instance, whether flesh be bread, or bread be flesh; whether whistling be a vice or a virtue; whether it be better to kiss a post, or throw it into the fire... (from Gulliver's Travels)
Previous
Reply
Map
View

Click here to load this message in the networking platform