# Filter results range time query

**URL:** <https://forum.inductiveautomation.com/t/filter-results-range-time-query/64338>\
**Category:** Ignition\
**Tags:** ignition81, vision\
**Created:** [September 21, 2022, 3:54pm UTC](https://forum.inductiveautomation.com/t/filter-results-range-time-query/64338 "2022-09-21T15:54:35Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Esmeralda\_Lopez](https://avatars.discourse-cdn.com/v4/letter/e/fbc32d/32.png) [@Esmeralda\_Lopez](https://forum.inductiveautomation.com/u/Esmeralda_Lopez)\
**Post date:** [September 21, 2022, 3:54pm UTC](https://forum.inductiveautomation.com/t/filter-results-range-time-query/64338/1 "2022-09-21T15:54:35Z")

</div>

Hello, how can I filter results with a query for every day with a specific time , for example:

```auto
Schedule | Results
08:00:00 am - 13:00:00 pm | cod_prod = 2142567 , dateDatabase = '2022-08-06 09:39:40'
                                         cod_prod = 2142567 , dateDatabase = '2022-08-06 11:58:10'
                                         cod_prod = 0978672 , dateDatabase = '2022-08-06 12:04:23'

```

I have this code:

`select cod_prod, dateDatabase from table1 where time_format(dateDatabase,'%r') between '01:00:00' and '02:52:55' ;`

Because I am going to put a the query in a graphic in ignition and then show the information for a specific schedule

---

<div class="post-metadata">

**Author:** ![justinedwards.jle](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/justinedwards.jle/32/37854_2.png) [@justinedwards.jle](https://forum.inductiveautomation.com/u/justinedwards.jle)\
**Post date:** [September 22, 2022, 5:31am UTC](https://forum.inductiveautomation.com/t/filter-results-range-time-query/64338/2 "2022-09-22T05:31:37Z")

</div>

Only the time matters, and not the date?

Also, which SQL server are you using (ie mysql, mssql, etc)

and it would also be helpful to know the datatype of the column you are pulling the date information from.

---

<div class="post-metadata">

**Author:** ![Esmeralda\_Lopez](https://avatars.discourse-cdn.com/v4/letter/e/fbc32d/32.png) [@Esmeralda\_Lopez](https://forum.inductiveautomation.com/u/Esmeralda_Lopez)\
**Post date:** [September 22, 2022, 12:04pm UTC](https://forum.inductiveautomation.com/t/filter-results-range-time-query/64338/4 "2022-09-22T12:04:13Z")

</div>

- I am using MySQL 8.0.
- The both matters Date and month but I think I need to do an operation like current\_day -1 to star since a day before.
- The datatype is DateTime.

---

<div class="post-metadata">

**Author:** ![Esmeralda\_Lopez](https://avatars.discourse-cdn.com/v4/letter/e/fbc32d/32.png) [@Esmeralda\_Lopez](https://forum.inductiveautomation.com/u/Esmeralda_Lopez)\
**Post date:** [September 22, 2022, 12:16pm UTC](https://forum.inductiveautomation.com/t/filter-results-range-time-query/64338/5 "2022-09-22T12:16:39Z")

</div>

let me check, thanks

---

<div class="post-metadata">

**Author:** ![justinedwards.jle](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/justinedwards.jle/32/37854_2.png) [@justinedwards.jle](https://forum.inductiveautomation.com/u/justinedwards.jle)\
**Post date:** [September 22, 2022, 1:47pm UTC](https://forum.inductiveautomation.com/t/filter-results-range-time-query/64338/6 "2022-09-22T13:47:46Z")

</div>

If I understand what you are wanting to do correctly, this is the query you are looking for:

```auto
SELECT `cod_prod`, `dateDatabase` FROM YOURDATABASENAME.table1 
WHERE `dateDatabase` >= NOW() - INTERVAL 1 DAY AND Time(`dateDatabase`) BETWEEN '01:00:00' AND '02:52:55'

```
