本文介绍了计算行项目类别的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述 我正在尝试使用sql查询来计算按类别显示在网页上的项目数。任何帮助将不胜感激 i想要计算Catagories的工作数 喜欢 I'm trying to get a sql query working to count the number of items by their categories to display on a webpage. Any assistance would be appreciatedi want to count the Catagories with jobslikeSales&Marketing(5)Accounts and Finance(2) 如此...我的桌子是 CataGories 表 as so on.. my tables are CataGories Table CatID CatName1 Sales&Markting2 Account and Finance3 Web DEVELOPMENT4 Media 和其他表格工作 and other table as JobJobID CatID JOBtitle 1 2 Sales Manager 2 2 Seles Executive 2 3 Java Developer 所以请告诉我我理解得到的结果So plz tell me i m understand to get result推荐答案 试试: Try:SELECT c.CatName, COUNT(j.JobID) FROM Job j JOIN Catagories c ON j.CatID=c.CatID GROUP BY C.CatName 尝试使用以下查询: Try to use below query:SELECT FROM (CatName + ' (' + CONVERT(VARCHAR(30),CountOfCtgs) + ')' SELECT C.CatName, COUNT(C.CatName) AS CountOfCtgs FROM Categories AS C INNER JOIN Job AS J ON C.CatID = J.CatID GROUP BY C.CatName ORDER BY C.CatName) AS T 我几乎没有尝试并解决它的问题 感谢所有 i hardly trying and solove its problem thanks to all Quote: SELECT c.CatName,COUNT(j.JobID)as Result FROM Job j right JOIN CATAGORIES c ON j .CatID = c.CatID GROUP BY C.CatName SELECT c.CatName, COUNT(j.JobID) as Result FROM Job j right JOIN CATAGORIES c ON j.CatID=c.CatID GROUP BY C.CatName 这篇关于计算行项目类别的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!
10-28 08:59