# Combine Multiple Fetches in Dynatrace Query Language (DQL)

**URL:** <https://community.dynatrace.com/t/combine-multiple-fetches-in-dynatrace-query-language-dql/42285>\
**Category:** DQL\
**Tags:** dql\
**Created:** [October 25, 2023, 6:05pm UTC](https://community.dynatrace.com/t/combine-multiple-fetches-in-dynatrace-query-language-dql/42285 "2023-10-25T18:05:31Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![rchillara](https://avatars.discourse-cdn.com/v4/letter/r/ee7513/32.png) [@rchillara](https://community.dynatrace.com/u/rchillara)\
**Post date:** [October 25, 2023, 6:05pm UTC](https://community.dynatrace.com/t/combine-multiple-fetches-in-dynatrace-query-language-dql/42285/1 "2023-10-25T18:05:31Z")

</div>

_Summary:&nbsp;This article explains how to combine multiple fetch operations in a single DQL query. It includes syntax examples and best practices for optimising queries in Dynatrace dashboards._

Hi,

What is the syntax to create a union of two fetch statmenents, bascially wanted a result of both fetch queires in a single statement

fetch `dt.entity.palo-alto:device`  
| fieldsAdd SystemName,deviceAddress,entity.type  
| fieldsRename ipaddress=deviceAddress,devicename=SystemName,type=entity.type

fetch `dt.entity.snmp:com_dynatrace_extension_snmp_generic_cisco_device`  
| fieldsAdd system\_name,dt.ip\_addresses,entity.type  
| fieldsRename ipaddress=dt.ip\_addresses,devicename=system\_name,type=entity.type

Appreciate your response.

Thanks & Regards,

Rama

---

<div class="post-metadata">

**Author:** ![stefan\_eggersto](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/stefan_eggersto/32/34114_2.png) [@stefan\_eggersto](https://community.dynatrace.com/u/stefan_eggersto)\
**Post date:** [October 27, 2023, 7:00am UTC](https://community.dynatrace.com/t/combine-multiple-fetches-in-dynatrace-query-language-dql/42285/2 "2023-10-27T07:00:06Z")

</div>

Hi&nbsp;[@rchillara](https://community.dynatrace.com/user/63956)&nbsp;,

the DQL equivalent for SQL union is the&nbsp;[append command](https://docs.dynatrace.com/docs/shortlink/dql-commands#append). The following query should work:

```auto
fetch `dt.entity.palo-alto:device`<br>| fieldsAdd SystemName,deviceAddress,entity.type<br>| fieldsRename ipaddress=deviceAddress,devicename=SystemName,type=entity.type<br>| append [<br>  fetch `dt.entity.snmp:com_dynatrace_extension_snmp_generic_cisco_device`<br> | fieldsAdd system_name,dt.ip_addresses,entity.type<br> | fieldsRename ipaddress=dt.ip_addresses,devicename=system_name,type=entity.type<br>]

```

---

<div class="post-metadata">

**Author:** ![rchillara](https://avatars.discourse-cdn.com/v4/letter/r/ee7513/32.png) [@rchillara](https://community.dynatrace.com/u/rchillara)\
**Post date:** [November 27, 2023, 2:13pm UTC](https://community.dynatrace.com/t/combine-multiple-fetches-in-dynatrace-query-language-dql/42285/3 "2023-11-27T14:13:22Z")

</div>

[@stefan\_eggersto](https://community.dynatrace.com/user/9516)&nbsp;thank you.
