# 凌晨1点至5点创建帖子的徽章

**URL:** <https://meta.discourse.org/t/badge-for-posts-created-between-1-am-and-5-am/178826>\
**Category:** Development\
**Tags:** badges\
**Created:** [2021 年2 月 7 日 22:41 UTC](https://meta.discourse.org/t/badge-for-posts-created-between-1-am-and-5-am/178826 "2021-02-07T22:41:52Z")\
**Posts on this page:** 1\
**Showing post:** 6

<div class="post-metadata">

作者： ![michebs](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/michebs/32/190102_2.png) [@michebs](https://meta.discourse.org/u/michebs)\
发布日期： [2021 年2 月 8 日 10:46 UTC](https://meta.discourse.org/t/badge-for-posts-created-between-1-am-and-5-am/178826/6 "2021-02-08T10:46:47Z")

</div>

您未获得该徽章，因为您添加了 `HAVING count(*) >= 100` 约束，因此只有在该时间间隔内发布超过 100 条帖子时，您才能获得该徽章。

```sql
SELECT 
    user_id, 
    current_timestamp granted_at 
FROM badge_posts p  
WHERE p.created_at::time BETWEEN '02:00' AND '06:00'
GROUP BY user_id 
HAVING count(*) >= 100

```

---

_[View the full topic](https://meta.discourse.org/t/badge-for-posts-created-between-1-am-and-5-am/178826)._
