# 日付別トピック閲覧数

**URL:** https://meta.discourse.org/t/topic-reads-by-date/153515
**Category:** Data & reporting
**Tags:** sql-query
**Created:** [2020 年 6 月 2 日午前 2:23 UTC](https://meta.discourse.org/t/topic-reads-by-date/153515 "2020-06-02T02:23:54Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![Divert](https://avatars.discourse-cdn.com/v4/letter/d/7ba0ec/32.png) [@Divert](https://meta.discourse.org/u/Divert)
#### Post date: [2020 年 6 月 2 日午前 2:23 UTC](https://meta.discourse.org/t/topic-reads-by-date/153515/1 "2020-06-02T02:23:54Z")

</div>

特定のトピックへの関心が時間とともにどのように変遷したかを見てみたいと考え、そのトピックの日別閲覧回数を取得するクエリを作成しました。

問題は、返されるカウントが UI 上に表示されているトピックのカウントよりも少ないことです。

何が不足しているか、ご存知ですか？

```
-- [params]
-- integer :tema = 1
select topic_id, viewed_at as fecha, count(1) as vistas from topic_views 
group by topic_id, viewed_at 
having topic_id = :tema
order by fecha asc

```
