SQL-如何计算列的唯一组合 [英] SQL - how to count unique combination of columns
本文介绍了SQL-如何计算列的唯一组合的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我不确定是否可行,但是我想计算表中唯一值的数量.我知道要计算我做的唯一FolderID的数量:
I'm not sure if this is possible but I want to count the number of unique value in a table. I know to count the number of unique folderIDs I do:
select count(folderid) from folder
但是我想计算文件夹表中folderid和userid的唯一组合的数量.有办法吗?
but I want the count of the number of unique combination of folderid and userid in the folder table. Is there a way to do this?
推荐答案
select count(*) from (
select distinct folderid, userid from folder
)
这篇关于SQL-如何计算列的唯一组合的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文