# User-posted code blocks in a category

**URL:** https://meta.discourse.org/t/user-posted-code-blocks-in-a-category/307712
**Category:** Data & reporting
**Tags:** sql-query
**Created:** [May 13, 2024, 2:50am UTC](https://meta.discourse.org/t/user-posted-code-blocks-in-a-category/307712 "2024-05-13T02:50:37Z")
**Posts on this page:** 1
**Showing post:** 4

<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: [May 13, 2024, 5:58pm UTC](https://meta.discourse.org/t/user-posted-code-blocks-in-a-category/307712/4 "2024-05-13T17:58:49Z")

</div>

You can also extend it to handle a user list version as well if you want to have multiple. eg:

```sql
-- [params]
-- user_list :users

SELECT 
    id AS user_id,
    created_at 
FROM users 
WHERE id IN (:users)

```

There’s a bit more info about some of the other magic parameters here - [Using Parameters in Data Explorer Queries](https://meta.discourse.org/t/utilizing-parameters-in-data-explorer-queries/277934)

There is a `category_id` and `group_id` parameter though they’re not as swish as the `user_id` one where you get a selection box (they work by typing in the name and it magically converts it to the id). They can be quite useful still, though.

(Also, another generally useful bit of info that can help refine some of the AI-assisted queries is [Common Discourse data tips](https://meta.discourse.org/t/common-discourse-data-tips/276148))

---

_[View the full topic](https://meta.discourse.org/t/user-posted-code-blocks-in-a-category/307712)._
