Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
假设我有一个包含 和 列的表格userId,videoId表示哪个用户在视频应用中观看了哪个视频。现在我想从表中获取视图计数和唯一视图计数,但只使用一个查询。这可能吗?这是示例的视觉效果:
userId
videoId
没关系,我想通了。我运行了以下查询:
SELECT video, count(user) AS views, count( DISTINCT user) AS uniqueViews FROM <table> GROUP BY videoId