![](/img/trans.png)
[英]Getting values from column B that do not have a corresponding value in column A
[英]List all values from column B and count distinct values in column A which have at least one record with corresponding A and B
列出B列中的所有值,並在A列中計數不同的值,這些值至少具有一條記錄,並具有相應的A和B
File name | File extension
--------------------------
100011 | txt
100011 | pdf
100017 | txt
100017 | pdf
100017 | txt
100018 | pdf
100018 | xls
預期結果
txt | 2
pdf | 3
xls | 1
使用不同的計數
select fileextension,count( distinct filename) from table
group by fileextension
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.