# Merging multiple columns into one in DQL

**URL:** <https://community.dynatrace.com/t/merging-multiple-columns-into-one-in-dql/53985>\
**Category:** DQL\
**Tags:** dql\
**Created:** [November 4, 2025, 5:29pm UTC](https://community.dynatrace.com/t/merging-multiple-columns-into-one-in-dql/53985 "2025-11-04T17:29:39Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![AK](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/ak/32/164_2.png) [@AK](https://community.dynatrace.com/u/AK)\
**Post date:** [November 4, 2025, 5:29pm UTC](https://community.dynatrace.com/t/merging-multiple-columns-into-one-in-dql/53985/1 "2025-11-04T17:29:39Z")

</div>

Hello Community,

I need help with DQL, I have a set of columns with names&nbsp;column1.1.1.0, column1.1.1.1, column1.1.1.2, column1.1.1.3.  
These columns do not always contain values, but one of them always will.  
For example:-

| column1.1.1.0 | column1.1.1.1 | column1.1.1.2 | column1.1.1.3 |
| --- | --- | --- | --- |
| | message3 | | |
| | | message6 | |
| message1 | | | |
| | | | message8 |
| message2 | | | |
| | message4 | | |
| | message5 | | |
| | | message7 | |
| | | | message9 |

My goal is to merge all of these source columns into a single new column. Could you please advise on the best method to accomplish this?

Regards,  
AK

---

<div class="post-metadata">

**Author:** ![Julius\_Loman](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/julius_loman/32/51_2.png) [@Julius\_Loman](https://community.dynatrace.com/u/Julius_Loman)\
**Post date:** [November 4, 2025, 8:45pm UTC](https://community.dynatrace.com/t/merging-multiple-columns-into-one-in-dql/53985/2 "2025-11-04T20:45:08Z")

</div>

If only one field has value for each record, you can use fieldsAdd with the coalesce function (takes the first non-null value):

```markup
data record(column1="abc"), record(column2="def"), record(column3="xyz")
| fieldsAdd coalesced=coalesce(column1, column2, column3)

```

If there are multiple values and you need concatenation, use the concat command instead:

```markup
data record(column1="abc"), record(column1="abc", column2="def"), record(column3="xyz")
| fieldsAdd concatenated=concat(column1, column2, column3)

```

---

<div class="post-metadata">

**Author:** ![AK](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/ak/32/164_2.png) [@AK](https://community.dynatrace.com/u/AK)\
**Post date:** [November 5, 2025, 11:47am UTC](https://community.dynatrace.com/t/merging-multiple-columns-into-one-in-dql/53985/3 "2025-11-05T11:47:16Z")

</div>

[@Julius\_Loman](https://community.dynatrace.com/user/3364), thank you for the useful response. This works however, I’m observing two more challenges

1. Number of columns are inconsistent across records (it could be 3, 4 or 5 based on the timeframe we select)
2. Column names themselves are not standardized (for e.g.-&nbsp;column2.1.1.0, column2.1.1.1, column2.1.1.2, column2.1.1.3). In the name, the word “column” is common.

Can we write a DQL query that dynamically coalesces columns, regardless of their count or names?

Thank you in advance.

Regards,  
AK

---

<div class="post-metadata">

**Author:** ![Julius\_Loman](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/julius_loman/32/51_2.png) [@Julius\_Loman](https://community.dynatrace.com/u/Julius_Loman)\
**Post date:** [November 5, 2025, 3:01pm UTC](https://community.dynatrace.com/t/merging-multiple-columns-into-one-in-dql/53985/4 "2025-11-05T15:01:18Z")

</div>

I don’t think that’s possible to do dynamically at the moment. You can use describe to get the names at least.
