How do I show the total amount of a equipment used on a assignment?

I need the total amount of times a piece of equipment was used in a assignment. Not sure if to use a count statement or group by.
Screenshot--884-_LI.jpg
Rob FriedAsked:
Who is Participating?
 
RayConnect With a Mentor Data AnalystCommented:
replace the assignmentID with ...
 count(*)

then at the very end add ....
GROUP BY equipment.serialno, name
0
 
Pawan KumarConnect With a Mentor Database ExpertCommented:
Try

SELECT e.SerialNo AS [Serial No] , MAX(Name) AS Name, COUNT(*) AS [TotalNumberOfTimeEquipmentIsUsed]
FROM Equipment AS e
LEFT OUTER JOIN Assignment AS a
ON e.SerialNo = a.SerialNo
GROUP BY e.SerialNo 

Open in new window

0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.