Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
SPT Combination Query
Message
 
 
À
10/02/2011 09:15:12
Steven Dyke
Safran Seats USA
Texas, États-Unis
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 9 SP1
OS:
Windows XP SP2
Network:
Windows 2008 Server
Database:
Visual FoxPro
Application:
Desktop
Divers
Thread ID:
01499611
Message ID:
01499616
Vues:
38
This message has been marked as the solution to the initial question of the thread.
>I have a table with recordnumber, goodparts, badparts.
>
>I need to know how many records there are for each goodparts and badparts.
>
>Right now I run one query for each.
>
>Select Count(recordnumber) As r1 From myTable Where goodparts > 0
>Select Count(recordnumber) As r1 From myTable Where badparts > 0
>
>How can I combine these two querys together to try and save processing time.
>
>The SPT table I am accessing is db2.
select sum(case when GoodParts > 0 then 1 else 0 end) as GoodPartsCount,
sum(case when BadParts > 0 then 1 else 0 end) as BadPartsCount
from myTable
I wrote this statement for SQL Server, check the analogue in db2
If it's not broken, fix it until it is.


My Blog
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform