# Sorting "merged" hubdb by different column names

**URL:** <https://community.hubspot.com/t/sorting-merged-hubdb-by-different-column-names/29418>\
**Category:** CMS Development\
**Created:** [December 20, 2020, 11:51pm UTC](https://community.hubspot.com/t/sorting-merged-hubdb-by-different-column-names/29418 "2020-12-20T23:51:42Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![BarryGrennan](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/barrygrennan/32/97794_2.png) [@BarryGrennan](https://community.hubspot.com/u/BarryGrennan)\
**Post date:** [December 20, 2020, 11:51pm UTC](https://community.hubspot.com/t/sorting-merged-hubdb-by-different-column-names/29418/1 "2020-12-20T23:51:42Z")

</div>

I’m using the below method to “merge” data from two different hubdb tables

```lia-code-sample
{% set table1 = hubdb_table_rows(xxxxxxx, query) %}
{% set table2 = hubdb_table_rows(yyyyyyy, query) %}

{% set all_tables = (table1 + table2) %}
{% set all_sorted = all_tables|sort(false,false,'date') %}

```

I’ve acheived this by giving table1 and table2 a column named “date”. But originally they were different column names. table1 had a column named “date”. table2 had a column named “start\_date”.

I’m happy enough with the column rename method. But out of curiosity is there a hubl method I could use to “merge” all the data and treat the “date” column and the “start\_date” column as one column without resorting to renaming one of them?

---

<div class="post-metadata">

**Author:** ![dennisedson](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/dennisedson/32/28044_2.png) [@dennisedson](https://community.hubspot.com/u/dennisedson)\
**Post date:** [December 21, 2020, 8:38pm UTC](https://community.hubspot.com/t/sorting-merged-hubdb-by-different-column-names/29418/2 "2020-12-21T20:38:20Z")

</div>

Hey @BarryGrennan

Going to throw a couple heavyweights into the convo here 😺

@stefen , @alyssamwilie you all have ideas?

---

<div class="post-metadata">

**Author:** ![stefen](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/stefen/32/29274_2.png) [@stefen](https://community.hubspot.com/u/stefen)\
**Post date:** [December 21, 2020, 8:51pm UTC](https://community.hubspot.com/t/sorting-merged-hubdb-by-different-column-names/29418/3 "2020-12-21T20:51:27Z")

</div>

@BarryGrennan @dennisedson I’m not sure if this would work since they aren’t simple lists/arrays. But the `extend` function seems like the exact thing you need — it merges two arrays into one: [HubL functions - HubSpot docs](https://developers.hubspot.com/docs/cms/hubl/functions#extend)

```lia-code-sample
{% set table1 = hubdb_table_rows(xxxxxxx, query) %}
{% set table2 = hubdb_table_rows(yyyyyyy, query) %}

{% set table1.extend(table2) %}

```
