Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
SPT Combination Query
Message
 
 
To
10/02/2011 09:15:12
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Environment versions
Visual FoxPro:
VFP 9 SP1
OS:
Windows XP SP2
Network:
Windows 2008 Server
Database:
Visual FoxPro
Application:
Desktop
Miscellaneous
Thread ID:
01499611
Message ID:
01499616
Views:
37
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
Previous
Reply
Map
View

Click here to load this message in the networking platform