# Convert field to tag

**URL:** <https://community.influxdata.com/t/convert-field-to-tag/913>\
**Category:** Systems\
**Tags:** influxdb\
**Created:** [May 12, 2017, 1:30pm UTC](https://community.influxdata.com/t/convert-field-to-tag/913 "2017-05-12T13:30:04Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![acanepalumile](https://sea1.discourse-cdn.com/flex023/user_avatar/community.influxdata.com/acanepalumile/32/1707_2.png) [@acanepalumile](https://community.influxdata.com/u/acanepalumile)\
**Post date:** [May 12, 2017, 1:30pm UTC](https://community.influxdata.com/t/convert-field-to-tag/913/1 "2017-05-12T13:30:05Z")

</div>

Hello,

I wish ask you if there are any way to convert fields to tags on existing measurement with many points.

Regards  
Ariel

---

<div class="post-metadata">

**Author:** ![jackzampolin](https://sea1.discourse-cdn.com/flex023/user_avatar/community.influxdata.com/jackzampolin/32/5_2.png) [@jackzampolin](https://community.influxdata.com/u/jackzampolin)\
**Post date:** [May 15, 2017, 5:21pm UTC](https://community.influxdata.com/t/convert-field-to-tag/913/2 "2017-05-15T17:21:06Z")

</div>

@acanepalumile You will need to rewrite the data. I would suggest trying a [`SELECT ... INTO`](https://docs.influxdata.com/influxdb/v1.2/query_language/data_exploration/#the-into-clause) query. Does that help?

---

<div class="post-metadata">

**Author:** ![acanepalumile](https://sea1.discourse-cdn.com/flex023/user_avatar/community.influxdata.com/acanepalumile/32/1707_2.png) [@acanepalumile](https://community.influxdata.com/u/acanepalumile)\
**Post date:** [May 15, 2017, 8:13pm UTC](https://community.influxdata.com/t/convert-field-to-tag/913/3 "2017-05-15T20:13:54Z")

</div>

Hi @jackzampolin, thank you very much for your answer!

I have already used select … into, but the field that I need to convert to tag is still a field. Basically, I have a measurement with this fields:

SALA: tag  
sector: field  
…

and I need that the field “sector” convert to tag for use it as a filter in templating. This measurement has many points inside.

Please, can you give me further informtation about how does it works. How does the select into convert a field into tag?

Regards  
Ariel

---

<div class="post-metadata">

**Author:** ![frank](https://avatars.discourse-cdn.com/v4/letter/f/3d9bf3/32.png) [@frank](https://community.influxdata.com/u/frank)\
**Post date:** [May 19, 2017, 12:59am UTC](https://community.influxdata.com/t/convert-field-to-tag/913/4 "2017-05-19T00:59:30Z")

</div>

Be sure to use GROUP BY to identify the tags.

For example:

select \* into B from A

all tags will be converted to fields.

select \* into B from A group by T

and T will be a tag in B, not a field.

---

<div class="post-metadata">

**Author:** ![acanepalumile](https://sea1.discourse-cdn.com/flex023/user_avatar/community.influxdata.com/acanepalumile/32/1707_2.png) [@acanepalumile](https://community.influxdata.com/u/acanepalumile)\
**Post date:** [May 29, 2017, 2:49pm UTC](https://community.influxdata.com/t/convert-field-to-tag/913/5 "2017-05-29T14:49:13Z")

</div>

Hello Frank,

Thank you very much for your answer.

Regards  
Ariel

---

<div class="post-metadata">

**Author:** ![Sofia\_Yfantidou](https://avatars.discourse-cdn.com/v4/letter/s/c6cbf5/32.png) [@Sofia\_Yfantidou](https://community.influxdata.com/u/Sofia_Yfantidou)\
**Post date:** [November 16, 2017, 8:56am UTC](https://community.influxdata.com/t/convert-field-to-tag/913/6 "2017-11-16T08:56:38Z")

</div>

I tried using this approach, but still my fields remain fields in the new measurement. Any ideas why?

> select \* into B from A group by T

My command:  
`select * into water_level from level group by location,level`

---

<div class="post-metadata">

**Author:** ![Hountruch](https://avatars.discourse-cdn.com/v4/letter/h/71e660/32.png) [@Hountruch](https://community.influxdata.com/u/Hountruch)\
**Post date:** [November 16, 2017, 7:02pm UTC](https://community.influxdata.com/t/convert-field-to-tag/913/7 "2017-11-16T19:02:44Z")

</div>

I have failed with select into. Now I’m out of ideas! Pissed off!
