Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Counting in an SQL statement
Message
 
 
À
21/09/2005 13:38:13
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Versions des environnements
Visual FoxPro:
VFP 8 SP1
OS:
Windows XP SP2
Database:
Visual FoxPro
Divers
Thread ID:
01051721
Message ID:
01051723
Vues:
15
This message has been marked as the solution to the initial question of the thread.
Tim,

Will this work for you?
Sum(IIF(Customerlineitem.packageindicatorcolortypecode="COLOR",1,0)) As ColorType;
>
>I have an SQL select statement where I am joining two tables. I want to be able to count for a field equaling a certain value. I've tried many variations of the COUNT and SUM functions in my SQL statement but I haven't got it to work. here is my SQL select statement:
>
>
>SELECT customerorder.jobnumbercode , Sum(Customerlineitem.packageindicatorquantity) AS PkgCount,;
>Sum(Customerlineitem.packageindicatorretouchflag) AS Retouch,;
>Sum(Customerlineitem.packageindicatorsoftfocusflag) AS SoftFocus,;
>Sum(Customerlineitem.packageindicatoreffectflag) AS Effects,;
>**Sum(Customerlineitem.packageindicatorcolortypecode="COLOR") As ColorType;
>FROM customerorder ;
>INNER JOIN customerlineitem ;
>ON Customerorder.orderkey = Customerlineitem.orderkey;
>WHERE Customerorder.ordercanceledflag = 0;
>GROUP BY customerorder.jobnumbercode
>
>
>I've indicated what line doesn't work (**). IF anyone has any ideas on how to fix this, I would very much appreciate it.
>
>Thanks!
>
>
--sb--
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform