Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
How to use an iif in T_select
Message
De
06/03/2012 11:42:48
John Baird
Coatesville, Pennsylvanie, États-Unis
 
Information générale
Forum:
ASP.NET
Catégorie:
Code, syntaxe and commandes
Divers
Thread ID:
01537399
Message ID:
01537403
Vues:
38
>Hi.
>I want to select from avtable , based on a Parameter (Say X)
>e.g. If Parameter = Blank, select all records, else select where a Filed eqauls parameter value
>
>In VFP, following works:
>SELECT * FROM MyTable WHERE IIF(X= " ",.t.,REF == X)
>
>Can something similar be done in Sql (Above simplified version... I could have 5 Where conditions)
>Tia
>Gerard


I would use a CASE statement:

SELECT CASE x
WHERE '' THEN true
WHERE .. THEN ..
WHERE .. THEN ..
ELSE X

END AS myField
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform