开发者

TSQL Howto get count of unique users?

This is really dumb question but still my head cannot work it out. I have a table with Orders, each o开发者_JS百科rder has userID in it. User can have unlimited amount of Orders. How do i make count of unique userIDs ?


You can;

SELECT COUNT(DISTINCT userID) 
FROM Tbl

You can give the count column a name by aliasing it:

SELECT COUNT(DISTINCT userID)  NumberOfDistinctUsers
FROM Tbl


select count(*) from
(select distinct userid form ordertable) d
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜