It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center。
已关闭8年。
我有一个表,其中有职员编号和学生编号,其中职员编号重复次数。
这样,我想按顺序选择那些职员编号。
已关闭8年。
我有一个表,其中有职员编号和学生编号,其中职员编号重复次数。
staffid | studentid
___________________
5 | 4
1 | 6
5 | 3
5 | 4
1 | 1
这样,我想按顺序选择那些职员编号。
staffid 5 (3)
staffid 1 (2)
最佳答案
如果您希望计数按降序排列,则查询中必须有一个“ order by”子句。
select staffid, count (*)
from table_name
group by staffid
order by count (*) desc
07-25 22:55