count Query in sql
问题 i have an issue with query 1st table (Master) Name :MainCategory with fields (Category_id,Category_name) 2nd Table (Transation) Name : Incident with fields (Incident_id,Category_id,subject,description) i want to query to count the appearance of category_id in the table Transation for eg result can be Category_name Number_of_Faults Hardware 10 Software 22 Network 17 thanks Kumar 回答1: Try this: SELECT a.Category_Name, COUNT(b.Incident_Id) Number_of_Faults FROM MainCategory a JOIN Incident b ON