# SQL table help with column

**URL:** <https://forum.inductiveautomation.com/t/sql-table-help-with-column/98401>\
**Category:** Ignition\
**Tags:** ignition81, perspective\
**Created:** [November 8, 2024, 5:43pm UTC](https://forum.inductiveautomation.com/t/sql-table-help-with-column/98401 "2024-11-08T17:43:49Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Hunter\_Holmes](https://avatars.discourse-cdn.com/v4/letter/h/b487fb/32.png) [@Hunter\_Holmes](https://forum.inductiveautomation.com/u/Hunter_Holmes)\
**Post date:** [November 8, 2024, 5:43pm UTC](https://forum.inductiveautomation.com/t/sql-table-help-with-column/98401/1 "2024-11-08T17:43:49Z")

</div>

im adding a column to the sequel query called renewaltime that adds 3 years to the table from the time column:

```python
SELECT [Time], 
    EmployeeName,
    BadgeNumber,
    Shift,
    Department,
    Position,
    Radio,
    Reason,
    DATEADD(YEAR, 3, [Time]) AS [RenewalTime]
FROM EarPlug_Tracker
WHERE NOT EmployeeName = '' AND [Time] BETWEEN :start_Time AND :end_Time 
ORDER BY Time DESC

```

in testing it works but in perspective view it does not work.

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/e/5/e57178a59cfe0107550228f9df3cdf751451795b.png)  
 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/e/f/ef1d21afbd332fece15821d4939189f319be4982.png)

---

<div class="post-metadata">

**Author:** ![Transistor](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/transistor/32/3380_2.png) [@Transistor](https://forum.inductiveautomation.com/u/Transistor)\
**Post date:** [November 8, 2024, 5:58pm UTC](https://forum.inductiveautomation.com/t/sql-table-help-with-column/98401/2 "2024-11-08T17:58:53Z")

</div>

This problem is usually because the `columns.n.field` property does not match the query column name. It should be  
`columns.8.field : RenewalTime`  
and capitalisation matters.

Tip: it may be pronounced "sequel" but it's written as "SQL", the initialisation of Structured Query Language. A "sequel table" would be one that follows a previous table. I suggest that you edit your question title and post so that it shows up correctly in search queries.

---

<div class="post-metadata">

**Author:** ![Hunter\_Holmes](https://avatars.discourse-cdn.com/v4/letter/h/b487fb/32.png) [@Hunter\_Holmes](https://forum.inductiveautomation.com/u/Hunter_Holmes)\
**Post date:** [November 8, 2024, 6:06pm UTC](https://forum.inductiveautomation.com/t/sql-table-help-with-column/98401/3 "2024-11-08T18:06:43Z")

</div>

unfortunately that was not the issue.

---

<div class="post-metadata">

**Author:** ![Transistor](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/transistor/32/3380_2.png) [@Transistor](https://forum.inductiveautomation.com/u/Transistor)\
**Post date:** [November 8, 2024, 6:38pm UTC](https://forum.inductiveautomation.com/t/sql-table-help-with-column/98401/4 "2024-11-08T18:38:12Z")

</div>

Right-click on the columns property, copy and paste here. Format it using the \</\> button. (See [Wiki - how to post code on this forum](https://forum.inductiveautomation.com/t/wiki-how-to-post-code-on-this-forum/77831) for more on this.)

---

<div class="post-metadata">

**Author:** ![Hunter\_Holmes](https://avatars.discourse-cdn.com/v4/letter/h/b487fb/32.png) [@Hunter\_Holmes](https://forum.inductiveautomation.com/u/Hunter_Holmes)\
**Post date:** [November 8, 2024, 6:48pm UTC](https://forum.inductiveautomation.com/t/sql-table-help-with-column/98401/5 "2024-11-08T18:48:07Z")

</div>

Thank you for your assistance but, I figured it out. I had an error when creating the table. I needed a + in front of the 3

```python
SELECT [Time], 
    EmployeeName,
    BadgeNumber,
    Shift,
    Department,
    Position,
    Radio,
    Reason,
    DATEADD(YEAR, +3, [Time]) AS [RenewalTime]
FROM EarPlug_Tracker
WHERE NOT EmployeeName = '' AND [Time] BETWEEN :start_Time AND :end_Time 
ORDER BY Time DESC

```

---

<div class="post-metadata">

**Author:** ![Transistor](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/transistor/32/3380_2.png) [@Transistor](https://forum.inductiveautomation.com/u/Transistor)\
**Post date:** [November 8, 2024, 7:41pm UTC](https://forum.inductiveautomation.com/t/sql-table-help-with-column/98401/6 "2024-11-08T19:41:55Z")

</div>

Good work. That may be SQL engine specific so it might help someone in the future if you state which flavour of SQL you're using (and include it in future questions).

Also, you can mark your post above as the "Solution" so it shows up on the main index as being solved.
