# column name same as function

**URL:** <https://forum.kx.com/t/column-name-same-as-function/11061>\
**Category:** Community Support\
**Tags:** kdb-and-q\
**Created:** [June 8, 2016, 7:36am UTC](https://forum.kx.com/t/column-name-same-as-function/11061 "2016-06-08T07:36:00Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![kefa1](https://avatars.discourse-cdn.com/v4/letter/k/cc9497/32.png) [@kefa1](https://forum.kx.com/u/kefa1)\
**Post date:** [June 8, 2016, 7:36am UTC](https://forum.kx.com/t/column-name-same-as-function/11061/1 "2016-06-08T07:36:00Z")

</div>

Hi,

I have a bunch of splayed tables with a column named last. Unfortunately when I try to include this in a select statement kdb assumes I am trying to use the last function.

Is there a way I can escape the column name so it doesn’t use the last function? Or do I need to rename my columns?

Cheers,

Kefa

---

<div class="post-metadata">

**Author:** ![ikorkhov1](https://avatars.discourse-cdn.com/v4/letter/i/d2c977/32.png) [@ikorkhov1](https://forum.kx.com/u/ikorkhov1)\
**Post date:** [June 8, 2016, 2:47pm UTC](https://forum.kx.com/t/column-name-same-as-function/11061/2 "2016-06-08T14:47:00Z")

</div>

I don’t think reserved words are good candidates for column names, but functional forms do work:

`q)meta tc | t f a----| -----date| d k | s last| iq)select from tdate k last-----------------2016.06.01 a 1 2016.06.01 b 2 2016.06.01 c 3 q)select last from t'rankq)?[`:/tmp/tmpdb/2016.06.01/t;();0b;(enlist`last)!enlist`last]last----1 2 3`

But I would rename columns if I could.

---

<div class="post-metadata">

**Author:** ![TerryLynch1](https://avatars.discourse-cdn.com/v4/letter/t/9e8a1a/32.png) [@TerryLynch1](https://forum.kx.com/u/TerryLynch1)\
**Post date:** [June 8, 2016, 3:10pm UTC](https://forum.kx.com/t/column-name-same-as-function/11061/3 "2016-06-08T15:10:00Z")

</div>

Agreed. You could also look into using .Q.id to ensure validity of column names:&nbsp;http://code.kx.com/wiki/DotQ/DotQDotid

## q).Q.id flip `col1`last`system!(`a`b;1 2;"xy") col1 last1 system1

a&nbsp;&nbsp;&nbsp; 1&nbsp;&nbsp;&nbsp;&nbsp; x  
b&nbsp;&nbsp;&nbsp; 2&nbsp;&nbsp;&nbsp;&nbsp; y

Terry
