# 凌晨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:** 1

<div class="post-metadata">

作者： ![cosdesign](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/cosdesign/32/208585_2.png) [@cosdesign](https://meta.discourse.org/u/cosdesign)\
发布日期： [2021 年2 月 7 日 22:41 UTC](https://meta.discourse.org/t/badge-for-posts-created-between-1-am-and-5-am/178826/1 "2021-02-07T22:41:52Z")

</div>

我担心自己对这些徽章上瘾了 🥰  
这个徽章将授予在凌晨 1 点到 5 点之间发布帖子的用户，并每日更新。  
但遗憾的是，我不知道如何筛选这个时间段。如有任何帮助，不胜感激。

```sql
SELECT user_id, current_timestamp AS granted_at 
FROM badge_posts p  
WHERE p.created_at > CURRENT_DATE /* 如何在 '1AM' 和 '5AM' 之间筛选？*/ 
GROUP BY user_id 
HAVING count(*) >= 100

```

 ![image](https://global.discourse-cdn.com/meta/original/3X/5/7/57fd86e7aeb83267f848f57b6567d11b3021c1df.png)

---

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