简体   繁体   中英

SQL - How do I retrieve the count of unique entires which correspond to non-unique entries?

I need to pull the count of the "Skill" column for each unique "FileID."

For example, my table looks like:

表例

So I would like the output in this scenario to be:

400100 - 4

400200 - 3

400300 - 3

I am still relatively new to SQL so hopefully what I am asking is clear.

Thank you!

use group by and aggregate function

select fieldid, count(skill)
from tablename
group by fieldid

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM