我有一张表是工作人员。该列为id_staff, no_staff
和id_posting
。我想算一下有多少人使用相同的id_posting。任何人都可以帮我查询吗?谢谢。
答案 0 :(得分:1)
您是否尝试过自己进行查询? 这是非常基本的
select count(id_staff), id_posting from staff where id_posting = ? group by id_posting
答案 1 :(得分:0)
select COUNT(*) AS ID_COUNT from YOUR_TABLE group by THE_ID_WHICH_IS_REPEATED
http://www.w3schools.com/sql/sql_func_count.asp 查看教程以获取更多信息。
答案 2 :(得分:0)
请试试这个
SELECT id_posting ,COUNT( `id_staff` ) as cnt_staff
FROM table_staff
GROUP BY id_posting