# Jdbc column join

**URL:** <https://discuss.elastic.co/t/jdbc-column-join/75129>\
**Category:** Logstash\
**Created:** [February 15, 2017, 3:23am UTC](https://discuss.elastic.co/t/jdbc-column-join/75129 "2017-02-15T03:23:10Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Greentea](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/greentea/32/15924_2.png) [@Greentea](https://discuss.elastic.co/u/Greentea)\
**Post date:** [February 15, 2017, 3:23am UTC](https://discuss.elastic.co/t/jdbc-column-join/75129/1 "2017-02-15T03:23:10Z")

</div>

Hi  
I want to ask is it possible and how to use filter to make to column join together?  
For example, I have a column call **brand** and another column call **name** in my database.

I want to use filter to make it look like

```
 "projectname" : "brand" "name" 

```

in index.

---

<div class="post-metadata">

**Author:** ![magnusbaeck](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/magnusbaeck/32/44943_2.png) [@magnusbaeck](https://discuss.elastic.co/u/magnusbaeck)\
**Post date:** [February 15, 2017, 6:40am UTC](https://discuss.elastic.co/t/jdbc-column-join/75129/2 "2017-02-15T06:40:31Z")

</div>

Why not just do the join in the SELECT clause of your SQL query?

---

<div class="post-metadata">

**Author:** ![Greentea](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/greentea/32/15924_2.png) [@Greentea](https://discuss.elastic.co/u/Greentea)\
**Post date:** [February 15, 2017, 8:24am UTC](https://discuss.elastic.co/t/jdbc-column-join/75129/3 "2017-02-15T08:24:01Z")

</div>

Because I do not have the right to modify the database.

---

<div class="post-metadata">

**Author:** ![magnusbaeck](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/magnusbaeck/32/44943_2.png) [@magnusbaeck](https://discuss.elastic.co/u/magnusbaeck)\
**Post date:** [February 15, 2017, 8:33am UTC](https://discuss.elastic.co/t/jdbc-column-join/75129/4 "2017-02-15T08:33:46Z")

</div>

You don't have to modify the database. I'm talking about concatenating the columns in the SELECT clause. Something like

```
SELECT (brand || " " || name) AS projectname, ... FROM ...

```

should work, possibly depending on your SQL dialect.

But sure, you could also use a Logstash filter:

```nohighlight
mutate {
  add_field => {
    "projectname" => "%{brand} %{name}"
  }
  remove_field => ["brand", "name"]
}

```

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [March 15, 2017, 8:34am UTC](https://discuss.elastic.co/t/jdbc-column-join/75129/5 "2017-03-15T08:34:11Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
