# Order HubDB Rows my multiple values (orderBy multiple columns)

**URL:** <https://community.hubspot.com/t/order-hubdb-rows-my-multiple-values-orderby-multiple-columns/34774>\
**Category:** CMS Development\
**Created:** [March 31, 2021, 10:00am UTC](https://community.hubspot.com/t/order-hubdb-rows-my-multiple-values-orderby-multiple-columns/34774 "2021-03-31T10:00:52Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![peesen](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/peesen/32/74736_2.png) [@peesen](https://community.hubspot.com/u/peesen)\
**Post date:** [March 31, 2021, 10:00am UTC](https://community.hubspot.com/t/order-hubdb-rows-my-multiple-values-orderby-multiple-columns/34774/1 "2021-03-31T10:00:52Z")

</div>

Hello

I need a HubDB output by lastname and then by firstname. So when two persons have the same lastname then it starts sorting by the firstname:

```lia-code-sample
{% set queryparam = "&orderBy=lastname" %}
{% set table = hubdb_table_rows('team', queryparam) %}

{% for row in table %}
<div class="team-member">
Name: {{ row.lastname }} {{ row.firstname }}
<span><a href="{{ request.path }}/{{ row.hs_path }}">Link to Profile</a></span>
</div>
 {% endfor %} 

```

---

<div class="post-metadata">

**Author:** ![piersg](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/piersg/32/99782_2.png) [@piersg](https://community.hubspot.com/u/piersg)\
**Post date:** [March 31, 2021, 11:11am UTC](https://community.hubspot.com/t/order-hubdb-rows-my-multiple-values-orderby-multiple-columns/34774/2 "2021-03-31T11:11:33Z")

</div>

Hi @peesen, you can include the orderBy parameter multiple times to sort by multiple columns so this should work:

`{% set queryparam = "&orderBy=lastname&orderBy=firstname" %}`
