Some tricky queries with relations

Hi everyone,

I have a table of deks

and users

and bookings

As you can see, I try to know if the user have a booking for today or tomorrow.
I used a rollup that can return me the latest booking so if a user book just for today (and have the previous booking) that’s fine. But if a user book for tomorrow, I’m screwed.

Any idea of how I could have a boolean for is_seated_today and is_seated_tomorrow?

Bonus question: if I can get them today and tomorrow booking details (like with a relation) it would be even better.

Another way would be able to filter a relation column for (or test it for the presence of) a particular date.

So my Booking relation would be filtered or tested with today and tomorrow column

Have you been able to solve this?

not yet

Can you try this:

  • Make a relation matching the “today” column to the “bookings” column. If the relation is not empty (as in it returns something) then Is_Seated_Today = True.

  • Do the same for “tomorrow”.

The “Today” and “Tomorrow” columns will be changed, so the boolean If > Then > Else columns will be changed as well.


It can’t work. Because then the relation will be only on the date, and gonna match the first booking for today no matter if it’s the current user or not.

  • At least it missing being able to put multiple conditions on a relation.
  • Or being able to select a relation column to make a relation :grin:
  • Or being able to do a CONTAIN condition on a IF THEN ELSE on Booking
1 Like

Just to confirm, what you want to return is whether in the bookings users have made, is there one that match today, and one that match tomorrow. Is that correct?

if in all the bookings made by the users (likely one every day) there’s one with the date = TODAY and one with the date = TOMORROW

What I mean for the relation was to match the today column to the “Booking” relation you have returned. Can you try that?