# Query Two Tables

**URL:** <https://community.glideapps.com/t/query-two-tables/79768>\
**Category:** Ask for Help\
**Created:** [February 4, 2025, 2:04pm UTC](https://community.glideapps.com/t/query-two-tables/79768 "2025-02-04T14:04:45Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ben164](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/ben164/32/54019_2.png) [@Ben164](https://community.glideapps.com/u/Ben164)\
**Post date:** [February 4, 2025, 2:04pm UTC](https://community.glideapps.com/t/query-two-tables/79768/1 "2025-02-04T14:04:45Z")

</div>

Good afternoon,

I am looking to establish an easy approach to query two tables: one with staff Clock in + out times (a log of all users) and the other with a weekly rota of shifts. I would like to check that a user checked into work on their shift within 30 mins of their shift start time, and shift end time. Ther rota table has Shift start and end time field with date and time - and the clock in and out table has the same.

What is the best approach here please? Is it best to have the data in two tables or in one perhaps?

Any help appreciated.

---

<div class="post-metadata">

**Author:** ![Darren\_Murphy](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/darren_murphy/32/47326_2.png) [@Darren\_Murphy](https://community.glideapps.com/u/Darren_Murphy)\
**Post date:** [February 4, 2025, 2:18pm UTC](https://community.glideapps.com/t/query-two-tables/79768/2 "2025-02-04T14:18:37Z")

</div>

It should be quite doable, but you need to define your exact requirement a bit more.

For example - is this just for a given date? For today? For a range of dates? How would you present the result on the user interface? What input will you be taking from the App user?

---

<div class="post-metadata">

**Author:** ![Ben164](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/ben164/32/54019_2.png) [@Ben164](https://community.glideapps.com/u/Ben164)\
**Post date:** [February 4, 2025, 2:32pm UTC](https://community.glideapps.com/t/query-two-tables/79768/3 "2025-02-04T14:32:09Z")

</div>

Thanks for this Darren.

It is simply for internal reporting really. The used case is for accounts teams to cross reference that a user’s shift in the rota table was 10am on 3rd Feb for example, and when they cross reference the Clock in and out table for staff, the check in time is within 30 mins of the rota shift time start? Does this make sense please?

---

<div class="post-metadata">

**Author:** ![Darren\_Murphy](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/darren_murphy/32/47326_2.png) [@Darren\_Murphy](https://community.glideapps.com/u/Darren_Murphy)\
**Post date:** [February 4, 2025, 2:54pm UTC](https://community.glideapps.com/t/query-two-tables/79768/4 "2025-02-04T14:54:15Z")

</div>

It makes sense, but I’m still not clear how your accounts team would interact with it.

For example, would you want to present a whole range of dates with clock in/out times on a single screen, or would they just be viewing data for a single date?

This is important, because if it’s just a single date then it should be easy. But if it’s a range of dates then you may need to introduce a helper table. But either way, the approach would be slightly different.

It would help if you can show how the two tables are structured, and what your accounts people would be seeing.

---

<div class="post-metadata">

**Author:** ![Ben164](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/ben164/32/54019_2.png) [@Ben164](https://community.glideapps.com/u/Ben164)\
**Post date:** [February 4, 2025, 3:09pm UTC](https://community.glideapps.com/t/query-two-tables/79768/5 "2025-02-04T15:09:37Z")

</div>

Thanks, I would imagine a whole range of dates as then you could cross check the times )or flag via IF function) if they were inside or outside the 30 mins please.

---

<div class="post-metadata">

**Author:** ![Darren\_Murphy](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/darren_murphy/32/47326_2.png) [@Darren\_Murphy](https://community.glideapps.com/u/Darren_Murphy)\
**Post date:** [February 4, 2025, 3:50pm UTC](https://community.glideapps.com/t/query-two-tables/79768/6 "2025-02-04T15:50:36Z")

</div>

Okay, that’s what I suspected. Can I see what the tables look like please?

> [@Darren\_Murphy](#):
>
> It would help if you can show how the two tables are structured, and what your accounts people would be seeing.

---

<div class="post-metadata">

**Author:** ![Ben164](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/ben164/32/54019_2.png) [@Ben164](https://community.glideapps.com/u/Ben164)\
**Post date:** [February 4, 2025, 6:11pm UTC](https://community.glideapps.com/t/query-two-tables/79768/7 "2025-02-04T18:11:39Z")

</div>

Thanks, have sent you a slack message with a Loom video.

Many thanks!

---

<div class="post-metadata">

**Author:** ![Darren\_Murphy](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/darren_murphy/32/47326_2.png) [@Darren\_Murphy](https://community.glideapps.com/u/Darren_Murphy)\
**Post date:** [February 5, 2025, 4:36am UTC](https://community.glideapps.com/t/query-two-tables/79768/8 "2025-02-05T04:36:03Z")

</div>

Had a look, and have responded.
