I have 3 tables:
Orders (Cust_ID, Order_Number, PN, Cost)
Parts (PN, Part_Name)
Customers (Cust_ID, Cust_Name)
Cust_ID in the Orders table is equal to Cust_ID in the Customers table.
PN in the Orders table is equal to PN in the Parts table.
Using Proc SQL I need a table with the first column grouped by "Cust_Name" and the second column the times (count) that each Cust_Name has made an order where the "Cost" is greater than 1000 and the "Part_Name" is equal to "Oring".
The result should come out:
Cust_Name Count Orders Greater than 1000 & Part_Name = Oring
Name1 3
Name2 5
......
3 and 5 mean that Name1 made 3 orders each greater than 1000 and Name2 made 5 orders each greater than 1000 and these 8 orders correspond to the Part_Name "Oring".
I have the following schematic but can't finish it to show me the count:
Proc SQL;
select Customers.Cust_Name
from Orders, Parts, Customers
group by Customers.Cust_Name
having
Orders.PN = Parts.PN
and
Orders.Cust_ID = Customers.Cust_ID
and
Orders.Cost ge 1000
and
Parts.Part_Name = 'Oring';
I am missing the syntax for it to display the second column (count), I used Count (*), Count (Orders.Cost), Count (Customers.Cust_Name), but none worked for me.
Thanks for your help.
@Count