# 为探险者查询查找投票名称和post\_id

**URL:** https://meta.discourse.org/t/finding-poll-name-and-post-id-for-an-explorer-query/240986
**Category:** Data & reporting
**Tags:** polls, sql-query
**Created:** [2022年二月9日 05:04 UTC](https://meta.discourse.org/t/finding-poll-name-and-post-id-for-an-explorer-query/240986 "2022-02-09T05:04:12Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![th21](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/th21/32/211915_2.png) [@th21](https://meta.discourse.org/u/th21)
#### Post date: [2022年二月9日 05:04 UTC](https://meta.discourse.org/t/finding-poll-name-and-post-id-for-an-explorer-query/240986/1 "2022-02-09T05:04:12Z")

</div>

如果创建投票时不为其命名，可以在哪里找到投票名称？另外，我假设帖子 ID 是包含投票的主题 ID，对吗？

---

<div class="post-metadata">

### Author: ![nathank](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/nathank/32/290039_2.png) [@nathank](https://meta.discourse.org/u/nathank)
#### Post date: [2022年二月10日 05:37 UTC](https://meta.discourse.org/t/finding-poll-name-and-post-id-for-an-explorer-query/240986/2 "2022-02-10T05:37:54Z")

</div>

> [@th21](#):
>
> 帖子ID是包含投票的帖子的ID，对吗？

恐怕不是——每个帖子都有自己的ID。以前很容易通过在浏览器地址栏中的帖子链接后面添加“.json”并按Enter键来查看它。但是，现在似乎不再是这样了，因为你会得到所有的帖子：

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

如果向下滚动，最终会找到感兴趣的帖子。投票名称也应该在里面，但如果不在，请编辑帖子，你会在markdown中看到它。

---

<div class="post-metadata">

### Author: ![th21](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/th21/32/211915_2.png) [@th21](https://meta.discourse.org/u/th21)
#### Post date: [2022年二月10日 05:50 UTC](https://meta.discourse.org/t/finding-poll-name-and-post-id-for-an-explorer-query/240986/3 "2022-02-10T05:50:27Z")

</div>

谢谢你的解释！我会去看看。

---

<div class="post-metadata">

### Author: ![system](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/system/32/443519_2.png) [@system](https://meta.discourse.org/u/system)
#### Post date: [2022年十月5日 08:44 UTC](https://meta.discourse.org/t/finding-poll-name-and-post-id-for-an-explorer-query/240986/4 "2022-10-05T08:44:14Z")

</div>

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.

---

<div class="post-metadata">

### Author: ![JammyDodger](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/jammydodger/32/254611_2.png) [@JammyDodger](https://meta.discourse.org/u/JammyDodger)
#### Post date: [2022年十月5日 10:47 UTC](https://meta.discourse.org/t/finding-poll-name-and-post-id-for-an-explorer-query/240986/5 "2022-10-05T10:47:50Z")

</div>

我以前做了一个小小的探险者查询，作为一种俏皮的查找方式，不过不确定它是否比 json 方法更容易。🙂 但这是它的样子：

```plaintext
-- [params]
-- int :topic_id
-- int :post_number = 1

SELECT pl.post_id, 
       p.id,
       pl.name
FROM polls pl
JOIN posts p ON p.id = pl.post_id
WHERE p.topic_id = :topic_id
AND p.post_number = :post_number

```
