# Suggestion required in Datetime configuration in Named Queries

**URL:** <https://forum.inductiveautomation.com/t/suggestion-required-in-datetime-configuration-in-named-queries/81453>\
**Category:** General Discussion\
**Tags:** database, ignition81, perspective\
**Created:** [November 3, 2023, 11:35am UTC](https://forum.inductiveautomation.com/t/suggestion-required-in-datetime-configuration-in-named-queries/81453 "2023-11-03T11:35:19Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![pturmel](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pturmel/32/3295_2.png) [@pturmel](https://forum.inductiveautomation.com/u/pturmel)\
**Post date:** [November 3, 2023, 11:43am UTC](https://forum.inductiveautomation.com/t/suggestion-required-in-datetime-configuration-in-named-queries/81453/2 "2023-11-03T11:43:39Z")

</div>

- Any given row timestamp can only be assigned to a single shift. In a CASE statement like shown, the first match wins.

- You are using `<=` for your shift ending times. That is likely incorrect, as a row exactly on a boundary matches two conditions. You should use half-open intervals.

Side note: This query will run very, very slowly when you get a bunch of rows, because you are converting your timestamps to strings to do your comparisons. This prevents efficient use of an index on your timestamps. Instead, convert your constant strings, **with dates** , to true timestamps, and compare **as timestamps**.

---

_[View the full topic](https://forum.inductiveautomation.com/t/suggestion-required-in-datetime-configuration-in-named-queries/81453)._
