Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Is this possible to do quickly with the SQL command?
Message
From
15/04/1998 16:13:45
 
 
To
15/04/1998 10:16:10
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00092144
Message ID:
00092271
Views:
16
Rick,

If I understood correctly, you might try something like the following:

SELECT;
Cust.Cust_No,;
SUM(IIF(Job.Priority = 1, 1, 0) AS [Pri1],;
SUM(IIF(Job.Priority = 2, 1, 0) AS [Pri2],;
SUM(IIF(Job.Priority = 3, 1, 0) AS [Pri3];
FROM;
Cust;
INNER JOIN;
Job;
ON Cust.Cust_No = Job.Cust_No;
GROUP BY 1;
INTO TABLE PriSum

-myron kirby-
myronk@flash.net
---------------------------------------------------------------

>Hi,
>
>I have a two tables, cust.dbf and job.dbf. They are linked by the cust_no field. The job table has a field called Priority which can have three values: 1, 2 or 3.
>
>I want to pull a report which will show the customer's cust_no, name, and then 3 other columns called Priority1, Priority2, priority3. Priority1 would be the total # of 1's, Priority2 would be # of 2's and Priority3 would be the number of 3's (for each customer).
>
>Can this be done *quickly* with an sql statement?
>
>Thanks in advance. -Rick
----------------------------------
-myron kirby (mkirby2000@gmail.com)-
Previous
Reply
Map
View

Click here to load this message in the networking platform