Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
IIF in Select
Message
De
24/11/1998 15:42:39
 
 
À
24/11/1998 14:42:14
Carl Sarazin
Statistics Canada
Ottawa, Ontario, Canada
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Titre:
Divers
Thread ID:
00161059
Message ID:
00161096
Vues:
23
>I'm trying to create a single SQL statement which will give a number of different count(conditional) reading the same variable.
>
>What I tried is using "sum(IIF(,,)) as xxx" several times in my select.
>Here is an instance of what I did.
>
>SELECT sum(IIF(rrspcont = 0,1,0)) as rrsp0,
> sum(IIF(rrspcont = 1,1,0)) as rrsp1, and so fourth
>FROM...
>
>Can I group the IIF in another IIF and still keep the same results?
>(sum(IIF(rrspcont = 0,1, IIF(...) without changing the variable
>name to store the result?
>
>Does anyone know if this is possible?

yep - you can nest IIF()s within a SELECT statement assignment. It's ugly and unreadable, but it can be (and, in my case, has been) done before. In most cases, rethinking the SELECT with nested IIF()s into a SELECT and a CrossTab is far more flexible and maintainable.
EMail: EdR@edrauh.com
"See, the sun is going down..."
"No, the horizon is moving up!"
- Firesign Theater


NT and Win2K FAQ .. cWashington WSH/ADSI/WMI site
MS WSH site ........... WSH FAQ Site
Wrox Press .............. Win32 Scripting Journal
eSolutions Services, LLC

The Surgeon General has determined that prolonged exposure to the Windows Script Host may be addictive to laboratory mice and codemonkeys
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform