# Query Help: lines tagged with a specific value

**URL:** https://community.silverbullet.md/t/query-help-lines-tagged-with-a-specific-value/4279
**Category:** Troubleshooting
**Created:** [July 24, 2026, 2:37pm UTC](https://community.silverbullet.md/t/query-help-lines-tagged-with-a-specific-value/4279 "2026-07-24T14:37:26Z")
**Posts on this page:** 7
**Page:** 1

<div class="post-metadata">

### Author: ![greencow](https://community.silverbullet.md/letter_avatar_proxy/v4/letter/g/977dab/32.png) [@greencow](https://community.silverbullet.md/u/greencow)
#### Post date: [July 24, 2026, 2:37pm UTC](https://community.silverbullet.md/t/query-help-lines-tagged-with-a-specific-value/4279/1 "2026-07-24T14:37:26Z")

</div>

I would like to create a query that scans all of my pages list any lines (not pages) with a specific tag value, for instance 'shopping'...

possible?

---

<div class="post-metadata">

### Author: ![henrikx](https://community.silverbullet.md/user_avatar/community.silverbullet.md/henrikx/32/161_2.png) [@henrikx](https://community.silverbullet.md/u/henrikx)
#### Post date: [July 25, 2026, 10:09pm UTC](https://community.silverbullet.md/t/query-help-lines-tagged-with-a-specific-value/4279/2 "2026-07-25T22:09:32Z")

</div>

Is this what you want?

```markdown
${query [[
  from p = index.paragraphs()
  where p.itags and table.includes(p.itags, "shopping")
  select { Page = "[[" .. p.page .. "]]", Line = p.text }
]]}

test #shopping

```

 ![image](https://community.silverbullet.md/uploads/default/original/2X/2/28b6669cc11c85aada2761a79ce9a7ec014deddb.png)

---

<div class="post-metadata">

### Author: ![greencow](https://community.silverbullet.md/letter_avatar_proxy/v4/letter/g/977dab/32.png) [@greencow](https://community.silverbullet.md/u/greencow)
#### Post date: [July 27, 2026, 12:59pm UTC](https://community.silverbullet.md/t/query-help-lines-tagged-with-a-specific-value/4279/3 "2026-07-27T12:59:21Z")

</div>

Thanks - yes. Will this also pick up any tagged tasks?

---

<div class="post-metadata">

### Author: ![henrikx](https://community.silverbullet.md/user_avatar/community.silverbullet.md/henrikx/32/161_2.png) [@henrikx](https://community.silverbullet.md/u/henrikx)
#### Post date: [July 27, 2026, 2:57pm UTC](https://community.silverbullet.md/t/query-help-lines-tagged-with-a-specific-value/4279/4 "2026-07-27T14:57:15Z")

</div>

No, but you can do the following

```auto
${combineTables(query [[
  from p = index.paragraphs()
  where p.itags and table.includes(p.itags, "shopping")
  select { Page = "[[" .. p.page .. "]]", Line = p.text }
]],
query [[
  from p = index.tasks()
  where p.itags and table.includes(p.itags, "shopping")
  select { Page = "[[" .. p.page .. "]]", Line = p.text }
]])
}

```

This requires the following space-lua

```lua
function combineTables(table1, table2)
  local result = table1
  for _, v in ipairs(table2) do
    table.insert(result,v)
  end
  return result
end

```

You can put space-lua for combineTables anywhere in your space. I recommend putting it somewhere like "Library/Custom/CombineTables" and tagging it with #meta. Remember to run a system reload in command-palette after adding the space-lua.

---

<div class="post-metadata">

### Author: ![greencow](https://community.silverbullet.md/letter_avatar_proxy/v4/letter/g/977dab/32.png) [@greencow](https://community.silverbullet.md/u/greencow)
#### Post date: [July 27, 2026, 3:46pm UTC](https://community.silverbullet.md/t/query-help-lines-tagged-with-a-specific-value/4279/5 "2026-07-27T15:46:23Z")

</div>

Perfect! Thanks so much.

---

<div class="post-metadata">

### Author: ![henrikx](https://community.silverbullet.md/user_avatar/community.silverbullet.md/henrikx/32/161_2.png) [@henrikx](https://community.silverbullet.md/u/henrikx)
#### Post date: [July 27, 2026, 6:09pm UTC](https://community.silverbullet.md/t/query-help-lines-tagged-with-a-specific-value/4279/6 "2026-07-27T18:09:37Z")

</div>

@zef Hi. Just wondering if there is a reason not to do `combineTables` with tables or if it should be included in Std-library? Something like `table.union`? Or is there a way to do this with what is there today in Std-library?

---

<div class="post-metadata">

### Author: ![zef](https://community.silverbullet.md/user_avatar/community.silverbullet.md/zef/32/7_2.png) [@zef](https://community.silverbullet.md/u/zef)
#### Post date: [July 28, 2026, 8:10am UTC](https://community.silverbullet.md/t/query-help-lines-tagged-with-a-specific-value/4279/7 "2026-07-28T08:10:54Z")

</div>

I think there's no off-the-shelf API to do this now, no. I try to stick to the Lua standard API as much as possible and not add _too_ much, although adding `table.union`, even as a non-standard API would be useful...
