I would like to perform a query where I can get SQL to “tally” up a number of actions performed. In this case I have an EmpNo which would be linked to an AcctNo that would be associated with a number of Orders.
What would be a way to approach this?
Sorry, about that, I’ve been thinking on this awhile and was honestly not sure how to set it up. But insofar
SELECT EmpNo, LastName, CustomerOrder.OrderNo AS 'Orders Handled"
FROM Employee
INNER JOIN Customer
ON Employee.EmpNo = Customer.AcctRepNo
ORDER BY LastName
You can perform this kind of query using COUNT() and GROUP BY:
You may need to qualify the column names in the SELECT if both
CustomerandEmployeehaveLastNamecolumns.